#include <bits/stdc++.h>
using namespace std;
priority_queue<int> q;
int n, f, c;
int main() {
  scanf("%d", &n);
  f = n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &c);
    q.push(c);
    while (q.top() == f) {
      printf("%d ", f);
      q.pop();
      f--;
    }
    if (f != 0) printf("\n");
  }
}
