#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, val;
  cin >> n;
  int TargetNum{n};
  array<bool, 1000001> has{false};
  for (int i = 0; i < n; ++i) {
    cin >> val;
    has[val] = true;
    while (has[TargetNum] == true) {
      cout << TargetNum-- << " ";
    }
    cout << endl;
  }
}
