#include <iostream>
#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;

void solve();

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

void solve()
{
    ll i, j, n, t, k, lpos;
    cin >> n;
    ll a[n];
    for (i = 0; i < n; i++)
        cin >> a[i];
    ll board[n][n];
    for (i = 0; i < n; i++)
        for (j = 0; j < n; j++)
            board[i][j] = -1;
    for (i = n - 1; i > -1; i--)
    {
        board[i][i] = a[i];
        lpos = i;
        t = a[i] - 1;
        if (!t)
            continue;
        for (j = i; j < n; j++)
        {
            if (board[j][i] == -1)
                lpos = j;
            for (k = i; k < n; k++)
            {
                if (board[j][k] != -1)
                    break;
                board[j][k] = a[i];
                t--;
                if (!t)
                    break;
            }
            if (!t)
                break;
        }
        if (!t)
            continue;
        for (j = i - 1; j > -1; j--)
        {
            for (k = lpos; k < n; k++)
            {
                if (board[k][j] != -1)
                    break;
                board[k][j] = a[i];
                t--;
                lpos = k;
                if (!t)
                    break;
            }
            if (!t)
                break;
        }
    }
    for (i = 0; i < n; i++)
    {
        for (j = 0; j <= i; j++)
            cout << board[i][j] << " ";
        cout << endl;
    }
    return;
}