Var a,b,i,min,j,sum:longint;
m:array[1..3,1..3] of longint;
begin
for i:=1 to 3 do
for j:= 1 to 3 do
read(m[i,j]);
for i:=1 to 3 do
if m[i,i]< 0 then
begin
for j:=1 to 3 do
sum:=sum+m[i,j];
writeln(i,' ',sum);
sum:=0;
end;
for i:=1 to 3 do
begin
writeln;
for j:= 1 to 3 do
write(m[i,j],' ');
end;
end.