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