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