program pascal;
type schimb=record
l1,c1,l2,c2:integer; lit1,lit2:char;
end;
var f,g:text;
v:array[1..600] of schimb; ok:boolean;
x,i,j,k,min,aux,n,pozl,pozc,p:integer;
a:array[0..300,0..300] of integer;
begin
assign(f,'grozavesti.in'); reset(f);
assign(g,'grozavesti.out'); rewrite(g);
readln(f,n);
ok:=true;
for i:=1 to n do
for j:=1 to n do
begin
read(f,a[i,j]);
if i=j then
if a[i,j]<a[i-1,j-1] then ok:=false;
end;
k:=0;
if not ok then
begin
for x:=1 to n do
begin
min:=maxint;
for i:=x to n do
for j:=x to i do
begin
if a[i,j]<min then
begin
min:=a[i,j];
pozl:=i;
pozc:=j;
end;
end;
if min<>a[x,x] then
begin
{interschimb}
for p:=1 to n do
begin
aux:=a[x,p];
a[x,p]:=a[pozl,p];
a[pozl,p]:=aux;
end;
inc(k);
v[k].lit1:='L'; v[k].l1:=pozl; v[k].l2:=x;
if a[x,x]<>min then
begin
for p:=1 to n do
begin
aux:=a[p,x];
a[p,x]:=a[p,pozc];
a[p,pozc]:=aux;
end;
inc(k);
v[k].lit2:='C'; v[k].c1:=pozc; v[k].c2:=x;
end;
end;
end;
writeln(g,k);
for i:=1 to k do
begin
if v[i].lit1='L' then writeln(g,v[i].lit1,' ',v[i].l2,' ',v[i].l1)
else
if v[i].lit2='C' then writeln(g,v[i].lit2,' ',v[i].c2,' ',v[i].c1);
end;
end
else write(g,0);
close(f);
close(g);
end.