#include <bits/stdc++.h>
using namespace std;
int main() {
  priority_queue<int> pq;
  int n;
  cin >> n;
  int maxm = n;
  int snacks;
  for (int i = 0; i < n; i++) {
    cin >> snacks;
    if (snacks >= maxm) {
      cout << snacks << " ";
      maxm--;
      while (!pq.empty()) {
        if (pq.top() >= maxm) {
          cout << pq.top() << " ";
          pq.pop();
        } else
          break;
        maxm--;
      }
      cout << "\n";
    } else {
      cout << "\n";
      pq.push(snacks);
    }
  }
  return 0;
}
