#include <bits/stdc++.h>
using namespace ::std;
const int maxn = 1e5 + 10;
int n, ptr, vis[maxn];
void solve() {
  scanf("%d", &n);
  ptr = n;
  for (int i = 0; i < n; i++) {
    int tmp;
    scanf("%d", &tmp);
    vis[tmp] = 1;
    if (tmp == ptr) {
      while (vis[ptr]) {
        printf("%d ", ptr);
        ptr--;
      }
    }
    puts("");
  }
}
int main() {
  solve();
  return 0;
}
