P12533 [XJTUPC 2025] 9-Nine

Background

"Kokonotsu Kokonoka Kokonoiro, Sorairo Sorauta Soranooto, Haruiro Harukoi Harunokaze, Yukiiro Yukihana Yukinoato." --- 9-nine-

Description

Artifact, a kind of magic item from anime called _Rinnetense No Moubiusu Ring_ , written by City Shiromitsukawa, comes true unpredictably! The User can get his or her own special ability. All of this story begins from that earthquake. "Thousands of years ago, the earth and the magic world were connected. The Artifact is just a magic item from the magic world. Because of lots of things, there was set up an organization called _Sefiruto_ (Tree of Kabbalah), retrieving all of the Artifacts, using magic to prevent the connection of two worlds. However, attributing to the earthquake, the gate was broken, and the Artifact came to this world again." ------ the muppet named Sophitia said so. With the help of Sophitia, our male lead KakeruNimi leads the four female leads in a fierce struggle against the villains, ultimately successfully preventing them from making unforgivable mistakes using Artifacts. After that, KakeruNimi and Sophitia decide to disconnect the two worlds, reusing the magic gate. The lock of the gate can be seen as two black and white matrices with size $9 \times 9$, and either KakeruNimi or Sophitia can control the matrix in his or her own world. They can: - KakeruNimi turns the matrix in his world to rotate by $90$ degrees to the left or right; - Sophitia turns the matrix in her world to rotate by $90$ degrees to the left or right (two matrices can be rotated independently); - KakeruNimi and Sophitia choose the same column of the matrices in two worlds and then swap them; When KakeruNimi's matrix is all white, as soon as Sophitia's matrix is all black, the gate will be locked, and then everyone can return to normal life. Time is limited, please YOU --- our "Nine" --- help them complete this task within $999$ steps. That being said, the question maker was warned that the question was too difficult, so he decided to narrow down the data range! Specifically, reduce the side length of the square matrix to $3$ and the number of steps to $9\times 9=81$! Formally speaking, there are two $3 \times 3$ 01 matrices $A$ and $B$, and you can do the following: - Operation $1$: Select matrix $A$ or $B$ and rotate it $90$ degrees to the left or right; - Operation $2$: Select the integer $k$ ($1 \le k \le 3$) and swap the $k$-th column of the two matrices. Please convert $A$ into a full 0 matrix within $81$ operations, ensuring that $B$ is always a full 1 matrix at this time.

Input Format

Line $1 \sim 3$, each line is a 01 string of length $3$, representing the initial state of matrix $A$. Line $4 \sim 6$, each line is a 01 string of length $3$, representing the initial state of matrix $B$. The data guarantees that within a finite number of operations, $A$ can be transformed into a full 0 matrix and $B$ into a full 1 matrix.

Output Format

The first line should be an integer $N$ ($0 \le N \le 81$), indicating that you need to perform a total of $N$ operations. The next $N$ lines should be in the following format: - If you choose to use operation $1$ for an item, please output the matrix name and rotation direction. Specifically: - If you want to rotate the $A$ matrix to the left by $90$ degrees , output $\tt{AL}$; - If you want to rotate the $A$ matrix to the right by $90$ degrees, output $\tt{AR}$; - If you want to rotate the $B$ matrix to the left by $90$ degrees , output $\tt{BL}$; - If you want to rotate the $B$ matrix to the right by $90$ degrees, output $\tt{BR}$. - If you choose to use operation $2$ for an item, please output $\tt{C}$ and column number. For example, if you want to swap the $2$nd column of two matrices, please output $\tt{C2}$. Where, rotating a matrix to the left means rotating it counterclockwise; Rotating a matrix to the right means rotating it clockwise. Please note: **Do not output extra spaces at the end of the line or carriage returns at the end of the text**.

Explanation/Hint

It can be proven that, under the condition of valid data, there must be a solution to the original question within step $999$, and the weakened version of the question must have a solution within step $81$. ~~The most important thing is that 9-nine- will release a new work this year and is expected to be launched on Steam in the winter.~~