{$APPTYPE CONSOLE}
program problem_f;
const
      filein  = 'f.in';
      fileout = 'f.out';
      maxn    = 100;
var
      i,j,k,l,m,n           : longint;
      a                     : array [0..maxn,0..maxn] of longint;
begin
  reset(input,filein); rewrite(output,fileout);
    read(n);
    i:=n; j:=n; k:=n*n+1; l:=1;
    repeat
      dec(k);
      a[i,j]:=k;
      if (l=1)and(a[i,j-1]=0)and(j-1>0) then dec(j) else
      if (l=1)and((a[i,j-1]<>0)or(j-1=0)) then
        begin
          l:=2;
          dec(i);
        end else

      if (l=2)and(a[i-1,j]=0)and(i-1>0) then dec(i) else
      if (l=2)and((a[i-1,j]<>0)or(i-1=0)) then
        begin
          l:=3;
          inc(j);
        end else

      if (l=3)and(a[i,j+1]=0)and(j+1<=n) then inc(j) else
      if (l=3)and((a[i,j+1]<>0)or(j=n)) then
        begin
          inc(i);
          l:=4;
        end else

      if (l=4)and(a[i+1,j]=0)and(i+1<=n) then inc(i) else
      if (l=4)and((a[i+1,j]<>0)or(i=n)) then
        begin
          l:=1;
          dec(j);
        end;

    until k=1;
  for i:=1 to n do
    begin
      for j:=1 to n do write(a[i,j],' ');
      writeln;
    end;
end.
