#include <bits/stdc++.h>

#define int  long long
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();
#ifdef foo
    freopen("input.txt", "r", stdin);
#endif
    int n;
    cin >> n;
    int p[n];
    int t[n];
    for (int i = 0; i < n; ++i) {
        cin >> p[i];
        t[i] = p[i];
    }
    int a[n][n];
    for (int j = 0; j < n; ++j) {
        for (int i = 0; i < n; ++i) {
            a[j][i] = -1;
        }
    }
    for (int k = n - 1; k >= 0; --k) {
        int x = k;
        int y = k;
        p[k]--;
        a[x][y] = t[k];
        while (true) {
            while (x != n - 1 && p[k] != 0 && a[x + 1][y] == -1) {
                p[k]--;
                a[x + 1][y] = t[k];
                x++;
            }
            if (p[k] == 0)break;
            if (y != 0 && a[x][y - 1] == -1) {
                p[k]--;
                a[x][y - 1] = t[k];
                y--;
                continue;
            }
            cout << -1;
            exit(0);
        }
    }
    for (int l = 0; l < n; ++l) {
        for (int i = 0; i <= l; ++i) {
            cout << a[l][i] << " ";
        }
        cout << "\n";
    }
}