#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define pb push_back
#define mod 1000000007
ll int power(ll int x, ll int y, ll int p)
{
    ll int res = 1;      // Initialize result
 
    x = x % p;  // Update x if it is more than or
                // equal to p
 
    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;
 
        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
 
// Returns n^(-1) mod p
ll int modInverse(ll int n, ll int p)
{
    return power(n, p-2, p);
}
 
int main()
{
    
    std::ios::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	ll n;
	cin>>n;
	ll p[n];
	ll i,j;
	ll a[n+1][n+1];
	for(i=0;i<=n;i++)
	for(j=0;j<=n;j++)
	a[i][j]=-1;
	for(i=0;i<n;i++)
	cin>>p[i];
	for(i=1;i<=n;i++)
	a[i][i]=p[i-1];
	
	for(i=n;i>0;i--)
	{
	    ll u=a[i][i];
	    int k=u;
	    int x=i;
	    int y=i;
	    u--;
	    
	    while(u>0)
	    {
	        //cout<<x<<y<<endl;
	        if(x<n)
	        {
	            //cout<<a[2][3]<<endl;
	            if(a[x+1][y]==-1)
	            {
	                //cout<<1<<endl;
	                a[x+1][y]=k;
	                //cout<<a[2][3]<<endl;
	                x++;
	            }
	            else if(y-1>=1&&a[x][y-1]==-1)
	            {
	                a[x][y-1]=k;
	                y--;
	            }
	            else
	            break;
	        }
	        else
	        {
	            if(y-1>=1)
	            {
	                a[x][y-1]=k;
	                y--;
	            }
	            else
	            break;
	        }
	        u--;
	    }
	    
	    if(u!=0)
	    {break;}
	}
	
	if(i!=0)
	cout<<-1<<endl;
	else
	{
	    for(i=1;i<=n;i++)
	    {
	        for(j=1;j<=i;j++)
	        cout<<a[i][j]<<" ";
	        cout<<endl;
	    }
	}
    return 0;
}