Const
n = 4;
var
a: array[1..n, 1..n] of integer;
i, j: integer;
begin
for i := 1 to n * n do
a[i mod n + 1, (i-1) div n + 1] := random(10);
for i := 1 to n do
begin
writeln();
for j := 1 to n do
begin
if i = j then a[i, j] := 0;
write(a[i, j]:3);
end;
end;
end.