#include <bits/stdc++.h>
using namespace std;
int n, x, poz;
bool v[100001];
int main() {
  cin >> n;
  poz = n;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    v[x] = 1;
    while (v[poz] == 1) cout << poz << ' ', poz--;
    cout << '\n';
  }
  return 0;
}
