#include <bits/stdc++.h>
using namespace std;
vector<string> v;
bool a[4][4],b[4][4];
void C(int x){
v.push_back("C"+to_string(x));
swap(a[1][x],b[1][x]);
swap(a[2][x],b[2][x]);
swap(a[3][x],b[3][x]);
}
void AL(){
v.push_back("AL");
int t1[4] = a[1],t2[4]=a[2],t3[4]=a[3];
a[1][1]=t1[3],a[1][2]=t2[3],a[1][3]=t3[3],a[2][1]=t1[2],a[2][2]=t2[2],a[2][3]=t3[2],a[3][1]=t1[1],a[3][2]=t2[1],a[3][3]=t3[1];
}
void AR(){
v.push_back("AR");
int t1[4] = a[1],t2[4]=a[2],t3[4]=a[3];
a[1][1]=t3[1],a[1][2]=t2[1],a[1][3]=t1[1],a[2][1]=t3[2],a[2][2]=t2[2],a[2][3]=t1[2],a[3][1]=t3[3],a[3][2]=t2[3],a[3][3]=t1[3];
}
void BL(){
v.push_back("BL");
int t1[] = b[1],t2[]=b[2],t3[]=b[3];
b[1][1]=t1[3],b[1][2]=t2[3],b[1][3]=t3[3],b[2][1]=t1[2],b[2][2]=t2[2],b[2][3]=t3[2],b[3][1]=t1[1],b[3][2]=t2[1],b[3][3]=t3[1];
}
void BR(){
v.push_back("BR");
int t1[] = b[1],t2[]=b[2],t3[]=b[3];
b[1][1]=t3[1],b[1][2]=t2[1],b[1][3]=t1[1],b[2][1]=t3[2],b[2][2]=t2[2],b[2][3]=t1[2],b[3][1]=t3[3],b[3][2]=t2[3],b[3][3]=t1[3];
}
int main(){
for (int i = 1 ;i<=3;i++) for (int j = 1;j<=3;j++) cin >> a[i][j];
for (int i = 1 ;i<=3;i++) for (int j = 1;j<=3;j++) cin >> b[i][j];
if (a[2][2]) C(2);
for(int i = 0; i < 4; i++) {
if(a[1][2] == '1') AL();
else if(a[2][3] == '1') AR(), AR();
else if(a[3][2] == '1') AR();
if(a[2][1] == '1') {
if(b[2][1] == '0') {}
else if(b[1][2] == '0') BL();
else if(b[2][3] == '0') BR(), BR();
else BR();
C(1);
}
}
for(int i = 0; i < 4; i++) {
if(a[1][3] == '1') AL(), AL();
else if(a[1][1] == '1') AL();
else if(a[3][3] == '1') AR();
if(a[3][1] == '1') {
if(b[1][1] == '0') {}
else if(b[1][3] == '0') BL();
else if(b[3][1] == '0') BR();
else BR(), BR();
C(1), AL(), C(1), AR(), C(1);
}
}
cout << v.size() << endl;
for (int i = 0;i<v.size();i++) cout << v[i] << endl;
}