Const maxN=101;
fi='XOANOC.INP';
fo='XOANOC.OUT';
Var a: array[0..MaxN,0..MaxN] Of Longint;
n,m: Longint;
Procedure Nhap;
Var i,j: Longint;
Begin
Assign(input,fi);
reset(input);
Read(n);
m:=n;
close(input);
end;
Procedure Xuat;
Var i,j: Longint;
Begin
Assign(output,fo);
rewrite(output);
For i:=1 to m do
begin
For j:=1 to n do
write(a[i,j],' ');
writeln;
end;
close(output);
end;
Function min(x,y: Longint):longint;
begin
min:=x;
if y<x then min:=y;
end;
Procedure taoA;
Var c1,c2,r1,r2,i,j,t,x: Longint;
begin
x:=0; c1:=1; c2:=n; r1:=1; r2:=m;
For t:=1 to (min(m,n)+1) div 2 do
begin
For j:=c1 to c2 do
begin
Inc(x); a[r1,j]:=x;
end;
inc(r1);
If n*m=x then exit;
For i:=r1 to r2 do
begin
Inc(x); a[i,c2]:=x;
end;
dec(c2);
If n*m=x then exit;
For j:=c2 downto c1 do
begin
Inc(x); a[r2,j]:=x;
end;
dec(r2);
If n*m=x then exit;
For i:=r2 downto r1 do
begin
Inc(x); a[i,c1]:=x;
end;
inc(c1);
If n*m=x then exit;
end;
end;
Begin
Nhap;
TaoA;
Xuat;
end.