#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, k = 0;
  set<int> s;
  cin >> n;
  int n0 = n;
  while (n0--) {
    cin >> x;
    s.insert(x);
    for (auto i = s.rbegin(); i != s.rend(); i++) {
      if (*i == n) {
        cout << *i << ' ';
        n--;
        k++;
      } else
        break;
    }
    s.erase(prev(s.end(), k), s.end());
    k = 0;
    cout << endl;
  }
  return 0;
}
