#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  bool used[100010] = {0};
  int a[100010] = {0};
  int m = n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    used[a[i]] = 1;
    if (a[i] == m) {
      while (used[m]) {
        cout << m << " ";
        m--;
      }
      cout << endl;
    } else {
      cout << endl;
    }
  }
  return 0;
}
