program Main;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  Mass : array of array of integer;
  xpos,ypos:integer;
  N,i,j,count:integer;
  filein:textfile;
  nap : byte;

begin
  assignfile(filein,'F.in');
  reset(filein);
  readln(filein,N);
  setlength(Mass,N+1,N+1);

  if N mod 2 = 0 then exit;
  
  for i:=1 to N do
    for j:=1 to N do
      Mass[i,j] := 0;

  xpos := (N div 2 ) +1;
  ypos := xpos;

  count := 1;
  nap := 1;
  Mass[xpos,ypos] := count;
  inc(count);

  while count <= (N*N) do
    begin
    //delaem
      case nap of
      1: begin
              Mass[xpos+1,ypos] := count;
              inc(count);
              inc(xpos);
          end;
      2: begin
              Mass[xpos,ypos-1] := count;
              inc(count);
              dec(ypos);
          end;
      3: begin
              Mass[xpos-1,ypos] := count;
              inc(count);
              dec(xpos);
          end;
      4: begin
              Mass[xpos,ypos+1] := count;
              inc(count);
              inc(ypos);
          end;

      end;

    //ishem naprav
      case nap of
        1: if Mass[xpos,ypos-1]=0 then nap:=2;
        2: if Mass[xpos-1,ypos]=0 then nap:=3;
        3: if Mass[xpos,ypos+1]=0 then nap:=4;
        4: if Mass[xpos+1,ypos]=0 then nap:=1;
      end;

    end;


  close(filein);

  assignfile(filein,'F.out');
  rewrite(filein);

  for j:=1 to N do
    begin
    for i:=1 to N do
      write(filein,Mass[i,j],' ');
    writeln(filein);
    end;

  close(filein);

end.
