#include<iostream>
#include <bits/stdc++.h>
#include<math.h>
#include <cmath>
#include <iomanip>
#include <vector> 
#include <unordered_map>
#include <unordered_set>
typedef long long int ll;
typedef long double ld;
#define ff(i, c, n) for (ll i = c; i < n; i++)
#define pb push_back
#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define maxn 10000001
using namespace std;
ll spf[maxn];
ll modu=1e9+7;
ll modv=998244353; 
ll fact[5005];
const ll N=1e3+7;
char c[N][N];
ll visited[N][N]={0};
bool iscycle=false;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
ll binpow(ll a, ll b, ll m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
ll gcd (ll a, ll b) {
    return b ? gcd (b, a % b) : a;
}
ll lcm (ll a, ll b) {
    return a / gcd(a, b) * b;
}
pair<ll, ll> fib (ll n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    ll c = ((p.first%modu * ((2 * p.second%modu)%modu)%modu - p.first%modu)%modu)%modu;
    ll d = ((p.first%modu * p.first%modu)%modu + (p.second%modu * p.second%modu)%modu)%modu;
    if (n & 1)
        return {d%modu, (c%modu + d%modu)%modu};
    else
        return {c%modu, d%modu};
}
void calcfact(){
    fact[1]=1;
    for(int i=2;i<=5004;i++){
        fact[i]=(fact[i-1]%modu*i)%modu;
    }
}
ll modInverse(ll a,ll m){
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1) return 0;
    while (a > 1){
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0) x += m0;
    return x;
}
void seive(){
    spf[1]=1;
    for(int i=1;i<maxn;i++) spf[i]=i;
    for(int i=2;i<maxn;i=i+2) spf[i]=2;
    for(int i=3;i*i<maxn;i=i+2){
        if(spf[i]==i){
            ll j=i*i;
            while(j<maxn){
                if(spf[j]==j) spf[j]=i;
                j=j+i;
            }
        }
    }
}
//<--------------------------------------------------------------------------------------------------------->>
ll n,m,cmp,cmp1; 
ll dx[]={0,1};
ll dy[]={-1,0};
ll ans[N][N];
bool isValid(ll x,ll y){
    if(x<1 || y<1 || x>=n || y>=m){
        return false;
    }
    if(visited[x][y]==1) return false;
    return true; 
}
void dfs(ll x,ll y){
    visited[x][y]=1;
    ans[x][y]=cmp;
    if(y-1>=1 && visited[x][y-1]==0 && cmp1>1){
        cmp1--;
        dfs(x,y-1);
    }
    if(x+1<=n && visited[x+1][y]==0 && cmp1>1){
        cmp1--;
        dfs(x+1,y);
    }
    if(cmp1==1) return;
}
ll dist[N][N];
int solve(){
    cin>>n;
    m=n;
    ll p[n+1];
    for(int i=1;i<=n;i++) cin>>p[i];
    // for(int i=0;i<n;i++){
    //     for(int j=0;j<m;j++){
    //         cin>>c[i][j];
    //     }
    // }
    memset(c,'1',sizeof(c));
    for(int i=0;i<N;i++){
        visited[i][i]=1;
    }
    for(int i=1;i<=n;i++){
        cmp=p[i];
        cmp1=p[i];
        dfs(i,i);
        if(cmp1!=1){
            cout<<-1<<endl;
            return 0;
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=i;j++){
            cout<<ans[i][j]<<" ";
        }
        cout<<endl;
    }
    return 0;
}
int main(){
    #ifndef ONLINE_JUDGE
    if (fopen("input.txt", "r"))
    {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }
    #endif
	ll t;
    t=1;
	//cin >> t;
	while(t--){
	   solve();
    }
	return 0;
}  