#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, k;
  cin >> n;
  int arr[n];
  map<int, int> m;
  int x = n;
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (i = 0; i < n; i++) {
    if (arr[i] == x) {
      cout << x << " ";
      x--;
      while (m[x]) {
        cout << x << " ";
        x--;
      }
    }
    m[arr[i]] = 1;
    cout << endl;
  }
  return 0;
}
