uses
  SysUtils;

var
  i,j:longint;
  n,midle,kol:longint;
  a:array[0..101,0..101] of longint;
  niz,verh,left,rigth:boolean;
begin
assign(input,'f.in');
reset(input);
read(n);
close(input);
midle:=(n div 2)+1;
i:=midle;
j:=midle;
kol:=1;
a[midle,midle]:=1;
niz:=true;
verh:=false;
left:=false;
rigth:=false;
while kol<sqr(n)do
begin
     if rigth=true then
     begin
        repeat
             dec(i);
             inc(kol);
             a[i,j]:=kol;
        until a[i,j-1]=0;
        rigth:=false;
        verh:=true;
     end;

     if verh=true then
     begin
        repeat
             dec(j);
             inc(kol);
             a[i,j]:=kol;
        until a[i+1,j]=0;
        verh:=false;
        left:=true;
     end;

     if left=true then
     begin
        repeat
             inc(i);
             inc(kol);
             a[i,j]:=kol;
        until a[i,j+1]=0;
        left:=false;
        niz:=true;
     end;

     if niz=true then
     begin
        repeat
             inc(j);
             inc(kol);
             a[i,j]:=kol;
        until (a[i-1,j]=0)or (kol=sqr(n));
        niz:=false;
        rigth:=true;
     end;
end;
assign(output,'f.out');
rewrite(output);
for i:=1 to n do
begin
  for j:=1 to n do  write(a[i,j],' ');
  writeln;
end;
close(output);
end.
 
