uses crt;
var
c,b:array[1..100,1..100] of integer;
i,j,n:longint;
q:boolean;
begin
textcolor(15);
randomize;
clrscr;
readln(n);
q:=true;
for i:=1 to n do
for j:=1 to n do
begin
c[i,j]:=random(50)+10;
b[i,j]:=c[i,j];
if c[i,j]<>c[j,i] then
q:=false;
end;
if q=true then
for i:=1 to n do
for j:=1 to n do
if i=j then
c[i,j]:=0;
if q=false then
for i:=1 to n do
for j:=1 to n do
begin
if ((i=1) and (j=n)) or ((i=n)and (j=1)) then
begin
textcolor(random(14)+1);
write(b[i,j],' ');
end
else
if i=j then
begin
textcolor(random(14)+1);
write(b[i,j],' ');
end
else
begin
textcolor(15);
write(b[i,j],' ');
end;
if j mod n = 0 then
writeln;
end;
if q=true then
begin
for i:=1 to n do
for j:=1 to n do
begin
if ((i=1) and (j=n)) or ((i=n)and (j=1)) then
begin
textcolor(random(14)+1);
write(b[i,j],' ');
end
else
if i=j then
begin
textcolor(random(14)+1);
write(b[i,j],' ');
end
else
begin
textcolor(15);
write(b[i,j],' ');
end;
if j mod n = 0 then
writeln;
end;
for i:=1 to n do
for j:=1 to n do
begin
if ((i=1) and (j=n)) or ((i=n)and (j=1)) then
begin
textcolor(random(14)+1);
write(c[i,j],' ');
end
else
if i=j then
begin
textcolor(random(14)+1);
write(c[i,j],' ');
end
else
begin
textcolor(15);
write(c[i,j],' ');
end;
if j mod n = 0 then
writeln;
end;
end;
readln;
end.