#include <bits/stdc++.h>
using namespace std;
const int N = 6;
int a[N][N];
char c;
vector<pair<char, int> > ans;
void R(int dex, bool p = true) {
  if (p) ans.push_back(pair<char, int>('R', dex + 1));
  int x = a[dex][5];
  for (int i = N - 1; i; i--) a[dex][i] = a[dex][i - 1];
  a[dex][0] = x;
}
void L(int dex) {
  ans.push_back(pair<char, int>('L', dex + 1));
  for (int i = 0; i < N - 1; i++) R(dex, false);
}
void D(int dex, bool p = true) {
  if (p) ans.push_back(pair<char, int>('D', dex + 1));
  int x = a[5][dex];
  for (int i = N - 1; i; i--) a[i][dex] = a[i - 1][dex];
  a[0][dex] = x;
}
void U(int dex) {
  ans.push_back(pair<char, int>('U', dex + 1));
  for (int i = 0; i < N - 1; i++) D(dex, false);
}
void row(int x, int y) {
  D(y);
  L(x);
  L(x);
  for (int i = 0; i < 5; i++) {
    if (i & 1)
      D(y);
    else
      U(y);
    L(x);
  }
}
void col(int x, int y) {
  R(x);
  U(y);
  U(y);
  for (int i = 0; i < 5; i++) {
    if (i & 1)
      R(x);
    else
      L(x);
    U(y);
  }
}
void move(int x1, int y1, int x2, int y2) {
  while (y1 < y2) row(x1, y1++);
  while (y1 > y2) row(x1, --y1);
  while (x1 > x2) col(--x1, y1);
}
void solve() {
  int want = -1;
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) {
      want++;
      int x, y;
      for (x = 0; x < N; x++) {
        for (y = 0; y < N; y++)
          if (a[x][y] == want) break;
        if (y < N && a[x][y] == want) break;
      }
      move(x, y, i, j);
    }
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) {
      cin >> c;
      if ('0' <= c && c <= '9')
        a[i][j] = c - '0';
      else
        a[i][j] = c - 'A' + 10;
    }
  solve();
  cout << ans.size() << '\n';
  for (pair<char, int> p : ans) cout << p.first << p.second << '\n';
}
