#include <bits/stdc++.h>
using namespace std;
int main() {
  (ios_base::sync_with_stdio(false), cin.tie(NULL));
  int n;
  cin >> n;
  vector<int> c(n);
  for (int i = 0; i < (int)(n); ++i) cin >> c[i];
  vector<bool> fallen(n + 1);
  int cur = n;
  for (int i = 0; i < (int)(n); ++i) {
    fallen[c[i]] = true;
    if (c[i] == cur) {
      while (fallen[cur]) cout << cur-- << " ";
      cout << endl;
    } else
      cout << endl;
  }
  return 0;
}
