Rotating Penguin Maze

No attempts yetTime limit1sMemory limit256 MB

Problem

A baby penguin has to reach the fish someone hid inside a maze, and it has to get there as fast as possible. The penguin reads a compass, so it understands the four instructions E, N, W and S. Each instruction moves it exactly one tile in that direction.

The maze has one more device. Some tiles carry a pressure plate, and when the penguin steps on such a tile the whole iceberg holding the maze turns 90 degrees counter clockwise. The penguin turns with the iceberg, so it never notices. The compass needle does not turn with the iceberg, so every time a plate fires you have to change the instructions you still have to give.

The maze always has exactly one path from the starting tile to the goal tile. Between every pair of tiles there is exactly one path, and the starting tile never carries a pressure plate.

Input

The first line contains the number of test cases TT.

The first line of each test case contains the maze size XX in the x direction and YY in the y direction. The next line contains four integers pxp_x, pyp_y, gxg_x, gyg_y, the penguin's starting coordinates and the coordinates of the goal tile. Then follow YY lines of XX characters each.

One character describes one tile. Its value is written as a single base 32 digit (00, 11, ..., 99, AA, BB, ..., VV) and is the sum of the features the tile contains. An east going passage adds 11, a north going passage adds 22, a west going one adds 44, and a south going one adds 88. A pressure plate adds 1616, written as GG. A tile value of HH, that is 1717, means the tile has an east going passage and a pressure plate.

The xx coordinate grows from left to right and the yy coordinate grows from top to bottom. Tile (x,y)(x, y) is character number x+1x+1 of line number y+1y+1, and north is the direction in which yy decreases.

  • 0<T1000 < T \le 100
  • 0<X5000 < X \le 500
  • 0<Y5000 < Y \le 500
  • 0px,gx<X0 \le p_x, g_x < X
  • 0py,gy<Y0 \le p_y, g_y < Y

Output

For each test case print one line with the compass instructions that guide the penguin along the shortest path to the tile holding the fish, written in order with no separator. Each instruction moves the penguin exactly one tile in the given direction. If the penguin already stands on the goal tile, print an empty line.