#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int l = n;
  map<int, int> cks;
  while (n--) {
    int x;
    scanf("%d", &x);
    cks[x]++;
    while (cks.find(l) != cks.end()) {
      printf("%d", l);
      l -= 1;
      if (cks.find(l) != cks.end()) {
        printf(" ");
      }
    }
    printf("\n");
  }
  return 0;
}
