#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> arr1(n + 1);
  bool scan = true;
  int key = n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    arr1[x]++;
    if (x == key)
      while (arr1[key]) {
        cout << key << " ";
        key--;
      }
    cout << endl;
  }
  return 0;
}
