uses crt;
var a:array[1..100,1..100]of integer;
n,i,j,k:integer;
begin
clrscr;
write('Nhap n='); readln(n);
i:=n div 2+1;
j:=n div 2+2;
for k:=1 to sqr(n) do
begin
a[i,j]:=k;
if k mod n=0 then j:=j+2
else begin
inc(j);
dec(i);
end;
if j>n then j:=j mod n;
if i=0 then i:=n;
end;
for i:=1 to n do
begin
for j:=1 to n do
write(a[i,j]:4);
writeln;
end;
readln;
end.