#include <bits/stdc++.h>
using namespace std;
int n, a[100001], i, fix[100001], x;
int main() {
  cin >> n;
  x = n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    fix[a[i]] = 12;
    while (fix[x] == 12) {
      cout << x << " ";
      x--;
    }
    cout << endl;
  }
}
