#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int n, has[MAXN];
int main() {
  scanf("%d", &n);
  for (int i = 1, t, cur = n; i <= n; ++i) {
    scanf("%d", &t);
    has[t] = 1;
    while (has[cur]) {
      printf("%d ", cur);
      --cur;
    }
    puts("");
  }
  return 0;
}
