import java.util.Arrays; import java.util.Scanner; import java.util.concurrent.SynchronousQueue; public class Main { public static void main(String[] args) { new Main().run(); } static int cnt = 0; static void run() { Scanner sc = new Scanner(System.in); char[][] m = new char[4][4]; for (int i = 0; i < 4; ++i) { m[i] = sc.next().toCharArray(); } for (int i = 0; i < 4; ++i) { for (int j = 0; j < 4 && 4 * i + j <= 12; ++j) { if (m[i][j] == (char) ('A' + 4 * i + j)) continue; for (int k = 0; k < 4; ++k) { for (int l = 0; l < 4; ++l) { if (m[k][l] != (char) ('A' + 4 * i + j)) continue; if (3 - k > 0) { m = toLower(l, 3 - k, m); } int g = 1; if ((j - 1 + 4) % 4 != l) { int d = (j - 1 - l >= 0 ? (j - 1 - l) : 4 + j - 1 - l); if (d != 0) { m = toRight(3, d, m); } } else { g = 3; int d = (j + 1 - l >= 0 ? (j + 1 - l) : 4 + j + 1 - l); if (d != 0) { m = toRight(3, d, m); } } m = toLower(l, k + 1, m); if (3 - i > 0) { m = toLower(j, 3 - i, m); } m = toRight(3, g, m); m = toLower(j, i + 1, m); } } } } while (m[3][1] != 'N') { m = toRight(3, 1, m); m = toLower(3, 1, m); m = toRight(3, 3, m); m = toLower(3, 3, m); m = toRight(3, 2, m); m = toLower(3, 1, m); m = toRight(3, 2, m); m = toLower(3, 3, m); m = toLower(3, 1, m); m = toRight(3, 1, m); m = toLower(3, 3, m); m = toRight(3, 3, m); } if (m[3][2] != 'O') { for (int t = 0; t < 2; ++t) { m = toLower(0, 1, m); m = toRight(3, 1, m); m = toLower(0, 3, m); if (t == 0) m = toRight(3, 2, m); else m = toRight(3, 1, m); } } System.out.println(cnt); System.out.println(ans); } static StringBuilder ans = new StringBuilder(); static char[][] toRight(int r, int a, char[][] m) { ans.append("R " + r + " " + a + "\n"); char[][] ret = new char[4][4]; for (int i = 0; i < 4; ++i) for (int j = 0; j < 4; ++j) ret[i][j] = m[i][j]; for (int i = 0; i < 4; ++i) { ret[r][i] = m[r][(i - a + 4) % 4]; } ++cnt; return ret; } static char[][] toLower(int c, int b, char[][] m) { ans.append("C " + c + " " + b + "\n"); char[][] ret = new char[4][4]; for (int i = 0; i < 4; ++i) for (int j = 0; j < 4; ++j) ret[i][j] = m[i][j]; for (int i = 0; i < 4; ++i) { ret[i][c] = m[(i - b + 4) % 4][c]; } ++cnt; return ret; } static void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } static void trMap(char[][] m) { for (char[] a : m) { tr(a); } } }