#include <bits/stdc++.h>
using namespace std;
char a[10][10];
vector<pair<char, int> > ans;
void uu(int x) {
  ans.push_back(make_pair('U', x));
  a[7][x] = a[1][x];
  for (int i = 1; i <= 6; ++i) {
    a[i][x] = a[i + 1][x];
  }
}
void dd(int x) {
  ans.push_back(make_pair('D', x));
  a[0][x] = a[6][x];
  for (int i = 6; i >= 1; --i) {
    a[i][x] = a[i - 1][x];
  }
}
void rr(int x) {
  ans.push_back(make_pair('R', x));
  a[x][0] = a[x][6];
  for (int i = 6; i >= 1; --i) {
    a[x][i] = a[x][i - 1];
  }
}
void ll(int x) {
  ans.push_back(make_pair('L', x));
  a[x][7] = a[x][1];
  for (int i = 1; i <= 6; ++i) {
    a[x][i] = a[x][i + 1];
  }
}
void swaph(int x, int y) {
  rr(x);
  uu(y);
  rr(x);
  dd(y);
  rr(x);
  uu(y);
  rr(x);
  dd(y);
  rr(x);
  uu(y);
  rr(x);
  rr(x);
  dd(y);
}
void swapv(int x, int y) {
  dd(y);
  ll(x);
  dd(y);
  rr(x);
  dd(y);
  ll(x);
  dd(y);
  rr(x);
  dd(y);
  ll(x);
  dd(y);
  dd(y);
  rr(x);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  for (int i = 1; i <= 6; ++i) {
    string s;
    cin >> s;
    for (int j = 1; j <= 6; ++j) {
      a[i][j] = s[j - 1];
    }
  }
  char c = '0';
  int x = 1, y = 1;
  for (int e = 1; e <= 36; ++e) {
    int l, r;
    for (int i = 1; i <= 6; ++i) {
      for (int j = 1; j <= 6; ++j) {
        if (a[i][j] == c) {
          l = i;
          r = j;
        }
      }
    }
    while (r > y) {
      swaph(l, r - 1);
      r--;
    }
    while (r < y) {
      swaph(l, r);
      r++;
    }
    while (l > x) {
      swapv(l - 1, r);
      l--;
    }
    c++;
    if (c == '9' + 1) c = 'A';
    y++;
    if (y == 7) {
      x++;
      y = 1;
    }
  }
  cout << ans.size() << '\n';
  for (int i = 0; i < ans.size(); ++i) {
    cout << ans[i].first << ans[i].second << '\n';
  }
}
