#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  priority_queue<int> q;
  int x, i = n;
  while (n--) {
    cin >> x;
    q.push(x);
    while (true) {
      if (!(q.empty()) && q.top() == i) {
        cout << i << " ";
        i--;
        q.pop();
      } else {
        cout << endl;
        break;
      }
    }
  }
  return 0;
}
