var a:string;
begin
readln(a);
writeln(a[3],a[4],a[5],a[6],a[9],a[11]);
writeln(a[4],a[5],a[6],a[3]);
writeln(a[4],a[6],a[5],a[1],a[3],a[4]);
end.
var a,b,c:string;
begin
readln(a,b,c);
writeln(a[1],c[2],a[2],b[1],c[1]);
end.
var a:string; i:integer;
begin
readln(a);
while pos('М',a)<>0 do begin
inc(i);
delete(a,pos('М',a),1);
end;
writeln(i);
end.