//
//#if defined(__APPLE__)
//freopen("./slyar.in", "r+", stdin);
//freopen("./slyar.out", "w+", stdout);
//#endif

//https://www.luogu.com.cn/problem/P4305

#include <bits/stdc++.h>
using namespace  std;

const int maxn = 505;
int matrix[maxn][maxn];
int tag[maxn];
int tag_2[maxn];
int get_up(int x,int y){
    return matrix[x - 1][y];
}
int get_right(int x , int y){
    return matrix[x ][y + 1];
}

void run(){
    int n;
    cin>>n;

    for(int i =1 ; i <= n; ++i){
        cin>>matrix[i][i];
        tag[ matrix[i][i] ] =  1;
    }

    for(int i = 2; i <= n ; ++i){
        memset(tag_2, 0 , sizeof(tag_2));
        int x = i ,  y = 1;
        while(x  <= n){

            if(tag[get_up(x , y)] == get_up(x , y) && !tag_2[get_right(x , y)  ] || tag_2[get_up(x , y) ] ){
                tag[get_right(x , y)] +=1;
                matrix[x][y] = get_right(x , y);
                tag_2[get_right(x , y)  ] = 1;
            }else  {
                tag[get_up(x , y)] +=1;
                matrix[x][y] = get_up(x , y);
                tag_2[get_up(x , y)  ] = 1;
            }
            //cout<<"asd  "<<x<<' '<<y<<' '<<matrix[x][y]<<' '<<tag_2[get_right(x , y) ] << endl;
            ++x;
            ++y;
        }
    }

    for(int i =1 ; i <= n; ++i){
        for(int j = 1; j <= n; ++j){
            if(matrix[i][j]!=0){
                cout<<matrix[i][j] <<' ';
            }
        }cout<<endl;
    }

}


int main()
{

#if defined(__APPLE__)
    freopen("./slyar.in", "r+", stdin);
    freopen("./slyar.out", "w+", stdout);
#endif

    run();
}






