#include <bits/stdc++.h>
using namespace std;
int n, a, cur;
priority_queue<int> pq;
int main() {
  scanf("%d", &n);
  cur = n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a);
    pq.push(a);
    while (!pq.empty() && pq.top() == cur) {
      printf("%d ", cur);
      pq.pop();
      cur--;
    }
    puts("");
  }
  return 0;
}
