#include <bits/stdc++.h>
using namespace std;
long long N = 1e5;
int main() {
  int x, curr, n;
  cin >> n;
  curr = n;
  vector<bool> excists(n + 1);
  for (int i = 0; i < n; ++i) {
    cin >> x;
    excists[x] = true;
    while (excists[curr]) cout << curr-- << " ";
    cout << "\n";
  }
}
