Construct the wall maze
1.a 6 by 6 grid of unit squares
2.3 walls of length between 1 and 6 which are placed either horizontally or vertically to separate squares
3.one start and one end marker
A maze may look like this:
When a maze is finished, a shortest path between the square with the start marker and the square with the end marker is determined. Only moves between adjacent grid squares are allowed; adjacent means that the grid squares share an edge and are not separated by a wall. It is not allowed to leave the grid.
Your task is: given a shortest path of some maze, construct this maze. Obviously, the maze you construct should be valid, i.e., all 3 walls should be used, they should not intersect with each other (although they may touch at some grid corner), and the walls should not stick out of the grid. Moreover, the given path should be valid for this maze, i.e., it should lead from the square with the start marker to the square with the end marker without crossing any wall or going outside of the grid, and there shouldn’t exist any shorter valid path.
The last test case is followed by a line containing three zeros.
There can be several valid solutions for a given test case (for example the test case in the sample input). Your program may print any of those solutions. Note that the sample output specifies the maze from the picture above.
1 1 2 NEEESWW 0 0 0
1 6 2 6 0 0 1 0 1 5 1 6 1 5 3 5