#include <bits/stdc++.h>
using namespace std;
#define zaman cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds "
#define rep(i,n) for(long long (i)=0;(i)<(n);++(i))
#define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i))	
#define endl '\n'
#define ll long long
#define pb push_back
#define pii pair<ll,ll>
#define mp make_pair
const int mx=2e5+6;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	int n;cin >> n;
	int a[n][n];
	rep(i,n)rep(j,n)a[i][j]=0;
	for(int i=0;i<n;++i){
		cin >> a[i][i];
	}
	for(int i=0;i<n;++i){
		int val=a[i][i];int res=val;
		int x=i;int y=i;
		while(1){
			a[x][y]=val;
			--res;
			if(res==0)break;
			if(y>0){
				if(a[x][y-1]==0){
					--y;continue;
				}
				if(a[x+1][y]==0){
					++x;continue;
				}
			}
			else if(a[x+1][y]==0){
				++x;continue;
			}

			cout << -1 << endl;return 0;
		}
	}


	for(int i=0;i<n;++i){
		for(int j=0;j<=i;++j){
			cout << a[i][j] << " ";
		}
		cout <<endl;
	}
}	

	