{"raw_statement":[{"iden":"statement","content":"There is a square box 6 × 6 in size. It contains 36 chips 1 × 1 in size. Those chips contain 36 different characters — \"_0_\"-\"_9_\" and \"_A_\"-\"_Z_\". There is exactly one chip with each character.\n\nYou are allowed to make the following operations: you may choose one of 6 rows or one of 6 columns and cyclically shift the chips there to one position to the left or to the right (for the row) or upwards or downwards (for the column). Those operations are allowed to perform several times.\n\nTo solve the puzzle is to shift the chips using the above described operations so that they were written in the increasing order (exactly equal to the right picture). An example of solving the puzzle is shown on a picture below.\n\n<center>![image](https://espresso.codeforces.com/2a692c7742758fb73f054ef438bd545382d6b500.png)</center>Write a program that finds the sequence of operations that solves the puzzle. That sequence **should not necessarily be shortest**, but you should not exceed the limit of 10000 operations. It is guaranteed that the solution always exists."},{"iden":"input","content":"The input data are represented by 6 lines containing 6 characters each. They are the puzzle's initial position. Those lines contain each character from the string \"_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_\" exactly once."},{"iden":"output","content":"On the first line print number _n_, which is the number of operations. On the next _n_ lines print the sequence of operations one per line. An operation is described by a word consisting of two characters. The first character shows the direction where the row or the column will be shifted. The possible directions are \"_L_\", \"_R_\" (to the left, to the right correspondingly, we shift a row), \"_U_\", \"_D_\" (upwards, downwards correspondingly, we shift a column). The second character is the number of the row (or the column), it is an integer from \"_1_\" to \"_6_\". The rows are numbered from the top to the bottom, the columns are numbered from the left to the right.\n\nThe number of operations should not exceed 104. If there are several solutions, print any of them."},{"iden":"examples","content":"Input\n\n01W345\n729AB6\nCD8FGH\nIJELMN\nOPKRST\nUVQXYZ\n\nOutput\n\n2\nR2\nU3"}],"translated_statement":[{"iden":"statement","content":"有一个大小为 $6\\times6$ 的方格盒子，其中包含 $36$ 个大小为 $1\\times1$ 的芯片。这些芯片上印有 $36$ 个不同的字符——\"_0_\" 到 \"_9_\" 以及 \"_A_\" 到 \"_Z_\"，每个字符恰好出现一次。\n\n你可以进行以下操作：选择一行或一列，并将其上的芯片循环移动一个位置，向左或向右（针对行），或向上或向下（针对列）。这些操作可以执行多次。\n\n解决谜题的目标是通过上述操作，使芯片按递增顺序排列（恰好与右图一致）。下图展示了一个解决谜题的例子。\n\n编写一个程序，找出解决该谜题的操作序列。该序列*不必是最短的*，但操作次数不得超过 $10000$ 次。保证解一定存在。\n\n输入数据由 $6$ 行组成，每行包含 $6$ 个字符，表示谜题的初始状态。这些行中包含了字符串 \"_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_\" 中的每个字符恰好一次。\n\n第一行输出一个数字 #cf_span[n]，表示操作次数。接下来的 #cf_span[n] 行每行输出一个操作。每个操作由两个字符组成的单词描述：第一个字符表示行或列的移动方向，可能的方向为 \"_L_\"、\"_R_\"（分别表示向左、向右，用于移动行），\"_U_\"、\"_D_\"（分别表示向上、向下，用于移动列）；第二个字符是行号或列号，为从 \"_1_\" 到 \"_6_\" 的整数。行从上到下编号，列从左到右编号。\n\n操作次数不应超过 #cf_span[104]。如果有多个解，输出任意一个即可。"},{"iden":"input","content":"输入数据由 $6$ 行组成，每行包含 $6$ 个字符，表示谜题的初始状态。这些行中包含了字符串 \"_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_\" 中的每个字符恰好一次。"},{"iden":"output","content":"第一行输出一个数字 #cf_span[n]，表示操作次数。接下来的 #cf_span[n] 行每行输出一个操作。每个操作由两个字符组成的单词描述：第一个字符表示行或列的移动方向，可能的方向为 \"_L_\"、\"_R_\"（分别表示向左、向右，用于移动行），\"_U_\"、\"_D_\"（分别表示向上、向下，用于移动列）；第二个字符是行号或列号，为从 \"_1_\" 到 \"_6_\" 的整数。行从上到下编号，列从左到右编号。操作次数不应超过 #cf_span[104]。如果有多个解，输出任意一个即可。"},{"iden":"examples","content":"输入\n01W345\n729AB6\nCD8FGH\nIJELMN\nOPKRST\nUVQXYZ\n输出\n2\nR2\nU3"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ B \\in (\\{0,1,\\dots,9,A,B,\\dots,Z\\})^{6 \\times 6} $ be the initial $6 \\times 6$ grid configuration, where each of the 36 distinct characters appears exactly once.  \nLet $ G \\in (\\{0,1,\\dots,9,A,B,\\dots,Z\\})^{6 \\times 6} $ be the goal grid defined by row-major ordering:  \n$$\nG[i][j] = \\text{char}(i \\cdot 6 + j), \\quad \\text{for } i,j \\in \\{0,1,2,3,4,5\\}\n$$  \nwhere $\\text{char}(k)$ maps $k \\in \\{0,1,\\dots,35\\}$ to the $k$-th character in the string `\"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\"`.\n\n**Operations**  \nLet a valid operation be one of the following:  \n- $ \\text{RowLeft}(r) $: cyclically shift row $ r \\in \\{1,\\dots,6\\} $ one position to the left.  \n- $ \\text{RowRight}(r) $: cyclically shift row $ r \\in \\{1,\\dots,6\\} $ one position to the right.  \n- $ \\text{ColUp}(c) $: cyclically shift column $ c \\in \\{1,\\dots,6\\} $ one position upward.  \n- $ \\text{ColDown}(c) $: cyclically shift column $ c \\in \\{1,\\dots,6\\} $ one position downward.  \n\n**Constraints**  \n1. The sequence of operations must transform $ B $ into $ G $.  \n2. The total number of operations $ n \\leq 10000 $.  \n\n**Objective**  \nFind a sequence $ \\mathcal{O} = (o_1, o_2, \\dots, o_n) $ of operations such that applying $ o_1, o_2, \\dots, o_n $ in order to $ B $ results in $ G $.  \nOutput $ n $, followed by each operation $ o_i $ in the format:  \n- `\"L r\"` for RowLeft(r)  \n- `\"R r\"` for RowRight(r)  \n- `\"U c\"` for ColUp(c)  \n- `\"D c\"` for ColDown(c)  \n\nwhere $ r, c \\in \\{1,2,3,4,5,6\\} $.","simple_statement":null,"has_page_source":false}