#include <bits/stdc++.h>
using namespace std;
const int M = 100002;
int a[M];
bool b[M];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  int m = n;
  for (int i = 0; i < n; ++i) {
    int x = a[i];
    b[x] = 1;
    while (x == m && b[x]) {
      printf("%d ", x);
      --m, --x;
    }
    puts("");
  }
  return 0;
}
