#include
#include
#define begin {
#define end }
using namespace std;
int main() {
int input;
while((cin >> input)&&input>0&&input<=100)
begin
int next = 1, x, y, z,weight;
x = 1;
y = 1;
z = 1;
weight = input;
array, 101> point;
for (int a = 0; a != 101; a++)
for (int b = 0; b != 101; b++)
point[a][b] = 0;
//point[1][1] = 0;
bool flag = true;
while (flag) {
point[x][y] = next;
if (y == z) {
y = 1; z++;
x = z;
}
else {
x--, y++;
}
if (z > input) {
flag = false;
continue;
}
next++;
}
for (int i = 1; i <= input; i++)
for (int j = 1; j <= input; j++) {
if (point[i][j] > 0) {
cout << point[i][j];
if (j != weight) {
cout << ' ';
}
else {
cout << endl;
weight--;
}
}
}
end
return 0;
}