Alex is a game developer working on a puzzle game with procedurally generated mazes. The game has different level configurations numbered from to d - 1. Each level is a w \times h grid where each cell is either a wall (black) or a path (white). All level configurations are distinct (that is, each two levels differ in at least one cell).
Alex needs to write an AI that spawns in the top-left cell of a level and must quickly identify which level configuration it's in. The AI executes a program written in a specific scripting language described below.
The scripting language for the AI consists of the following commands:
U, D, L, R -- movement commands. The AI moves one cell up, down, left, or right respectively. If a movement command moves the AI outside the grid, the program fails.
( <subprogram_path> : <subprogram_wall> ) -- conditional operator. The AI checks the type of the cell it's currently on. If it's a path (white) then <subprogram_path> is executed, otherwise <subprogram_wall> is executed.
0, 1, …, 9 -- level identification commands. The AI must execute one of these commands when it knows which level it's on. After such command, the program terminates.
Each movement command takes one time unit to execute. The execution of conditional operator and level identification commands is instantaneous.
Alex wants a program that always works correctly. That is, if the AI spawns on level , then the execution of the program must end with command i.
Given the set of level configurations, design a correct program for the AI, such that its execution time in the worst case is minimal.
The first line contains three integers , , and (1 \le d \le 10; 1 \le h, w \le 10) -- the number of level configurations, the height and the width of each level.
The rest of the input file contains descriptions of levels. Each description consists of lines of length . All characters are either B or W, representing a wall (black) or a path (white) respectively.
Level descriptions are given in the order from to d - 1. Descriptions are separated by an empty line.
Return a correct program for the AI with minimal possible worst-case execution time. If there are multiple possible programs, output any of them.
All whitespace is ignored when parsing a program.
The AI has to distinguish between the given level configurations in the example.
Example 1