program test;
var matrix: array of array of integer;
i, j, n: integer;
begin
read(n);
setlength(matrix, n, n);
for i := 0 to n div 2 - 1 do
for j := 0 to n - 1 do begin
matrix[2 * i, j] := j + 1;
matrix[2 * i + 1, j] := n - j
end;
for i := 0 to n - 1 do begin
for j := 0 to n - 1 do
write(matrix[i, j], ' ');
writeln
end
end.