#include <bits/stdc++.h>
using namespace ::std;
const long long maxn = 6;
const long long mod = 1e9 + 7;
const long long inf = 1e9 + 500;
vector<pair<char, long long> > ans;
char jad[maxn][maxn];
char opp[maxn][maxn];
char aaa[maxn][maxn];
void copyy() {
  for (long long i = 0; i < maxn; i++) {
    for (long long j = 0; j < maxn; j++) {
      opp[i][j] = jad[i][j];
    }
  }
}
void prin() {
  cout << "===========================\n";
  for (long long i = 0; i < 6; i++) {
    for (long long j = 0; j < 6; j++) {
      cout << opp[i][j];
    }
    cout << endl;
  }
}
void act(char c, long long i) {
  ans.push_back(make_pair(c, i + 1));
  if (c == 'U') {
    for (long long j = 0; j < 5; j++) {
      swap(opp[j][i], opp[(j + 5) % 6][i]);
    }
    return;
  }
  if (c == 'R') {
    for (long long j = 5; j > 0; j--) {
      swap(opp[i][j], opp[i][(j + 5) % 6]);
    }
    return;
  }
  if (c == 'L') {
    for (long long j = 0; j < 5; j++) {
      swap(opp[i][j], opp[i][(j + 1) % 6]);
    }
    return;
  }
  if (c == 'D') {
    for (long long j = 5; j > 0; j--) {
      swap(opp[j][i], opp[(j + 1) % 6][i]);
    }
    return;
  }
  cout << "RIDI";
}
void pri() {
  cout << ans.size() << endl;
  for (long long i = 0; i < ans.size(); i++) {
    cout << ans[i].first << ans[i].second << endl;
  }
}
pair<long long, long long> fin(char c) {
  for (long long i = 0; i < 6; i++) {
    for (long long j = 0; j < 6; j++) {
      if (opp[i][j] == c) {
        return make_pair(i, j);
      }
    }
  }
}
bool hal() {
  for (long long i = 0; i < 5; i++) {
    for (long long j = 0; j < 6; j++) {
      char c = aaa[i][j];
      pair<long long, long long> v = fin(c);
      long long ii = v.first;
      long long jj = v.second;
      if (ii == i && jj == j) {
        continue;
      }
      if (ii == i) {
        act('D', jj);
        act('L', ii + 1);
        act('U', jj);
        ii++;
        jj--;
      }
      if (jj == j) {
        act('L', ii);
        jj = (jj + 5) % 6;
      }
      for (long long u = 0; u < ii - i; u++) {
        act('D', j);
      }
      while (jj != j) {
        act('R', ii);
        jj = (jj + 1) % 6;
      }
      for (long long u = 0; u < ii - i; u++) {
        act('U', j);
      }
    }
  }
  for (long long j = 0; j < 6; j++) {
    if (aaa[5][j] != opp[5][j]) {
      return 0;
    }
  }
  return 1;
}
int main() {
  srand(time(0));
  for (long long i = 0; i < 6; i++) {
    for (long long j = 0; j < 6; j++) {
      cin >> jad[i][j];
    }
  }
  copyy();
  for (long long i = 0; i < 6; i++) {
    for (long long j = 0; j < 6; j++) {
      if (i * 6 + j <= 9) {
        aaa[i][j] = 6 * i + j + '0';
      } else {
        aaa[i][j] = 6 * i + j - 10 + 'A';
      }
    }
  }
  while (hal() == 0) {
    ans.clear();
    copyy();
    for (long long i = 0; i < 50; i++) {
      long long c = rand() % 4;
      long long v = rand() % 6;
      if (c == 0) {
        act('U', v);
      }
      if (c == 1) {
        act('D', v);
      }
      if (c == 2) {
        act('R', v);
      }
      if (c == 3) {
        act('L', v);
      }
    }
  }
  pri();
}
