Var
a:array [1..3,1..5] of integer;
i,j,max,jmax,t:integer;
begin
for i:=1 to 3 do
begin
for j:=1 to 5 do
read(a[i,j]);
readln;
end;
writeln;
max:=a[1,1];
jmax:=1;
for i:=1 to 3 do
for j:=1 to 5 do
if a[i,j]>max then
begin
max:=a[i,j];
jmax:=j;
end;
for i:= 1 to 3 do
begin
t:=a[i,1];
a[i,1]:=a[i,jmax];
a[i,jmax]:=t;
end;
for i:=1 to 3 do
begin
for j:=1 to 5 do
write(a[i,j],' ');
writeln;
end;
end.