#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v;
int n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    v.push_back({-t, i});
  }
  sort(v.begin(), v.end());
  int j = 0;
  for (int i = 0; i < n; i++) {
    int t = 0;
    while (i >= v[j].second && j < n) {
      if (t == 1) cout << " ";
      cout << n - j;
      t = 1;
      j++;
    }
    cout << '\n';
  }
}
