#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    int a[1000], m, x = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    m = n;
    for (int i = 0; i < n; i++) {
      if (a[i] < m) {
        printf("\n");
        x++;
        continue;
      }
      printf("%d", a[i]);
      a[i] = 0;
      int t = m;
      if (x > 0) {
        sort(a, a + i);
        for (int j = i - 1; j > i - 1 - x; j--) {
          if (a[j] == t - 1) {
            if (a[j] == 0) break;
            printf(" %d", a[j]);
            a[j] = 0;
            m--;
            t = m;
          }
        }
        x = 0;
      }
      m--;
      printf("\n");
    }
  }
}
