var n,i,j,x1,x2,x3:integer;
	a:array[1..100,1..100] of integer;
procedure main(var x:integer);
begin       
x1:=1;
x2:=x*x;
x3:=x;
j:=x3;
repeat
i:=x3;
for j:=x3 downto x1 do
begin
a[i,j]:=x2;
x2:=x2-1;
end;
j:=x1;
for i:=x3-1 downto x1 do
begin
a[i,j]:=x2;
x2:=x2-1;
end; 
i:=x1;
for j:=x1+1 to x3 do
begin
a[i,j]:=x2;
x2:=x2-1;
end;
j:=x3;
for i:=x1+1 to x3-1 do
begin
a[i,j]:=x2;
x2:=x2-1;
end;
x1:=x1+1;
x3:=x3-1;
until x1=x3; 	
end;  
begin
assign(input,'f.in');
assign(output,'f.out');
reset(input);
rewrite(output);
read(n);
main(n);
for i:=1 to n do
begin
for j:=1 to n do
write(a[i,j],' ');
writeln;
end;
close(input);
close(output);
end.