var A:array [1..100,1..100] of longint;
i,j,n,o,p,t,r:longint;
begin
assign(input,'F.in');
reset(input);
assign(output,'F.out');
rewrite(output);
read(input,n);
o:= n div 2 +1;
a[o,o]:= 1;
a[o,o+1]:= 2;    a[o-1,o+1]:=3;
t:=o+1; o:=o-1;
p:= 3;  r:=2;
while p<=sqr(n) do begin
for j:= 1 to r do begin
t:=t-1; p:=p+1; a[o,t]:=p;    end;
for j:=1 to r do begin
o:=o+1; p:=p+1; a[o,t]:=p;    end;
r:=r+1;
for j:= 1 to r do begin
t:=t+1; p:=p+1; a[o,t]:=p;    end;
for j:= 1 to r do begin
o:=o-1; p:=p+1; a[o,t]:=p;    end;
r:=r+1;
end;
     for i:= 1 to n do begin
for j:= 1 to n do
write(output,a[i,j]:5);
writeln(output);end; close(output); end.