#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
int main() {
  int n;
  int a[100010];
  bool visited[100010];
  memset(visited, 0, sizeof visited);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  int ptr = n;
  for (int i = 0; i < n; i++) {
    visited[a[i]] = 1;
    while (ptr > 0 && visited[ptr]) cout << ptr << " ", ptr--;
    cout << endl;
  }
  return 0;
}
