test #1
program Project3;
{$APPTYPE CONSOLE}
uses
SysUtils;
type
re=array[1..4,1..4] of char;
var
c,r:re ;
i,j:integer;
s:string;
procedure vyvod(m:re) ;
begin
for I := 1 to 4 do
for j := 1 to 4 do
if m[i,j]='X' then write(r[i,j]);
end;
procedure perevorot(var w:re) ;
var
w2:re;
begin
vyvod(w);
for I := 1 to 4 do
for j := 1 to 4 do
w2[i,j]:='.';
for I := 1 to 4 do
if w[1,i]='X' then w2[i,4]:='X';
for I := 1 to 4 do
if w[4,i]='X' then w2[i,1]:='X';
for I := 2 to 3 do
if w[i,1]='X' then w2[1,5-i]:='X';
for I := 2 to 3 do
if w[i,4]='X' then w2[4,i]:='X';
//rgrgr X
if w[2,2]='X' then w2[2,3]:='X';
if w[2,3]='X' then w2[3,3]:='X';
if w[3,3]='X' then w2[3,2]:='X';
if w[3,2]='X' then w2[2,2]:='X';
for I := 1 to 4 do
for j := 1 to 4 do
w[i,j]:=w2[i,j];
end;
begin
for I := 1 to 4 do begin
for j := 1 to 3 do begin
read(c[i,j]);
end;
readln(c[i,j]);
end;
for I := 1 to 4 do begin
for j := 1 to 3 do begin
read(r[i,j]);
end;
readln(r[i,j]);
end;
perevorot(c);
perevorot(c);
perevorot(c);
perevorot(c);
readln;readln;
end.