### Maze

Time Limit: 2000 ms Memory Limit: 65536 KiB

#### Problem Description

We are all familiar with conventional mazes laid out on a 2-D grid. A 3-D maze can be constructed as follows: Consider a hollowed out cube aligned along the x, y and z axes with one corner at (0,0,0) and the opposite corner at (n − 1, n − 1, n − 1). On each face of the cube is a 2-D maze made by removing a subset of 1 × 1 × 1 cubes from the face (no edge cubes are removed). The object of the maze is to move a marker located inside the cube from an initial location of (1,1,1) to the final destination of (n − 2,n − 2,n − 2). However, attached to this marker are 6 rods, each protruding through one face of the cube. The movement of these rods is constrained by the 2-D mazes on the faces. The picture below gives an example of a 7 × 7 × 7 maze. Note that this maze is not physically realizable since some faces (e.g., the front face containing the letter “A”) have cubes that are disconnected from the edges of the face. Such mazes are allowed in this problem.
The black regions indicate open spaces where the rods can move. The figure to the right specifies the possible directions that the rods can move (Forward, Back, Left, Right, Up, Down) and also defines the labels for the six sides of the cube. In the maze above, the rods are shown in their initial position centered at (1,1,1). From here they can not move Forward, Backward, Right, Left or Down, but they can move Up (assuming there are open spaces for the two back rods to move to).
To specify a cube, a description of each face must be given. For this problem, the order and orientations of each face are given in the diagram below.
U
U
U
U
B
F
L
F
R
F
R
B
R
B
L
B
L
F
L
U
R
L
D
R
D
D
D
D
F
B
The first square represents the Forward face oriented so that the shared edge with the Up face is on top and the shared edge with the Right face is on the right, the second square represents the Right face oriented with the shared edge with the Up face on top and the shared edge with the Back face on the right, and so on. Your job is to solve such mazes in the minimum number of moves.

#### Input

Each test case will start with a single line containing the value of n, where n lies between 4 and 30, inclusive. Next will come descriptions of each face in the order and orientation shown above. The description of each face will consist of n lines each containing one string of length n. The characters in the string will be either a blank or ‘X’, indicating either an empty or full square, respectively. The last test case will be followed by a line containing 0.

#### Output

Output will consist of one line for each test case. Each line will contain a description of a minimum-move solution that moves the marker from cell (1,1,1) to cell (n − 2, n − 2, n − 2). Moves are either F, B, L, R, U or D. In case of a tie, choose the sequence of moves which is lexicographically first, where we consider F < B < L < R < U < D. All mazes will have solutions.

#### Sample Input

7
XXXXXXX
XXXXXXX
X
X
X
X
X XXX X
X X X X
X
X
X
X
X XXX X
X X X X
X XXX X
X
X
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
X
X
X XXX X
X X X X
X XXX X
X X X X
X XXX X
X X X X
X XXX X
X X X X
X
X
XXXXXXX
XXXXXXX
XXXXXXX
XXXXXXX
X
X
X
X
X
X
X XXX X
X
X
X X X X
X
X
X XXX X
X
X
X
X
XXXXXXX
XXXXXXX
0

#### Sample Output

UULLLLUUBBBB