#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  map<int, int> check;
  long long n, i, flag, j;
  cin >> n;
  flag = n;
  long long a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    check[a[i]] = 1;
    for (j = flag; j >= 0; j--) {
      if (check[j] == 1)
        cout << j << " ";
      else
        break;
    }
    cout << endl;
    flag = j;
  }
}
