#include <iostream>
#include <vector>
using namespace std;

int main() {
    int count = 0;
    int num = 1;
    int x;
    while (cin >> count) { // 注意 while 处理多个 case
    vector<vector<int>> store(count);
        for(int i = 0;i<count;i++){{
            int tem = i;
            for(int j = 0;j<count&&tem>=0;j++){
                    store[tem].push_back(num);
                    num++;
                    tem--;
                }
            }
        }
        for(int i = 0;i<store.size();i++){
            for(int j = 0;j<store[i].size();j++){
                if(j == store[i].size()-1){
                    cout<<store[i][j]<<endl;
                }else{
                    cout<<store[i][j]<<' ';
                }
            }
        }
    }
}
// 64 位输出请用 printf("%lld")