program Main;

{$APPTYPE CONSOLE}

uses
  SysUtils;

VAR n,x,y,sh,c:integer;
    mas: array [1..100,1..100] of integer;
procedure initvse;
var i,j:integer;
begin
for i:=1 to 100 do for j:=1 to 100 do mas[i,j]:=0;
end;

procedure vivod;
var i,j:integer;
begin
for i:=1 to n do
begin
for j:=1 to n do write(mas[i,j],' ');
writeln;
end;
end;
BEGIN
  assign(input,'f.in');
  reset(input);
  assign(output,'f.out');
  rewrite(output);
  readln(n);
  initvse;
  x:=n+1;
  y:=n;
  sh:=n*n+1;
  c:=1;
  repeat
   case c of
   1:begin
      if not((x-1<=0) or (mas[y,x-1]<>0))
         then begin
                x:=x-1;
                sh:=sh-1;
                mas[y,x]:=sh;
              end
         else c:=2;
     end;
   2:begin
       if not((y-1<=0) or (mas[y-1,x]<>0))
         then begin
                y:=y-1;
                sh:=sh-1;
                mas[y,x]:=sh;
              end
         else c:=3;
     end;
   3:begin
       if not((x+1>=n+1) or (mas[y,x+1]<>0))
         then begin
                x:=x+1;
                sh:=sh-1;
                mas[y,x]:=sh;
              end
         else c:=4;
     end;
   4:begin
       if not((y+1>=n+1) or (mas[y+1,x]<>0))
         then begin
                y:=y+1;
                sh:=sh-1;
                mas[y,x]:=sh;
              end
         else c:=1;
     end;
   end;
  until sh=1;

  vivod;
  close(output);
END.
