#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[100005] = {0};
  bool b[100005] = {0};
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int c = n;
  for (int i = 0; i < n; i++) {
    b[a[i]] = true;
    while (b[c] && c > 0) {
      printf("%d ", c--);
    }
    printf("\n");
  }
  return 0;
}
