<Problem>
http://ntucoder.net/Problem/Details/32
Uses Crt;
Var i,j,n,x,y,hangcheo:longint;
a:array[1..100,1..100] of longint;
Begin
readln(n);
x:=1; y:=1; hangcheo:=1;
for i:=1 to sqr(n) do
begin
a[x,y]:=i;
if (hangcheo=2) and (x=n) then begin inc(y); hangcheo:=1; end else
if (hangcheo=1) and (y=n) then begin inc(x); hangcheo:=2; end else
if (hangcheo=2) and (y=1) then begin inc(x); hangcheo:=1; end else
if (hangcheo=1) and (x=1) then begin inc(y); hangcheo:=2; end else
if (hangcheo=1) then begin dec(x); inc(y); end else
begin inc(x); dec(y); end;
end;
for i:=1 to n do
begin
for j:=1 to n do write(a[i,j],' ');
writeln;
end;
End.