#include <stdio.h>
#include <string.h>

int main()
{

    int s[100][100] = {0};
    //观察到分为 i = 1 2 3 4 5 五组
    //用j遍历这五组 num++ 记录当前数值  行列之和为当前组-1
    //列数为j-1 % i取余
    int group;
    while (scanf("%d", &group) != EOF)
    {
        int  num = 0;
        for (int i = 1; i <= group; i++)
        {
            for (int j = 1; j <= i; j++)
            {
                ++num;
                int col = (j - 1) % i;
                s[i-1-col][col] = num;
            }
        }

        for (int i = 0; i < group; i++)
        {
            for (int j = 0; j < group - i; j++)
            {
                printf("%d ", s[i][j]);
            }
            printf("\n");
        }
    }

    return 0;
}