#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, m, a[100005] = {};
  cin >> n;
  m = n;
  while (n--) {
    cin >> x;
    a[x] = 1;
    while (a[m]) {
      cout << m << ' ';
      m--;
    }
    cout << endl;
  }
  return 0;
}
