#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int* nums = new int[n];
  int* occured = new int[n]{0};
  for (int i = 1; i <= n; ++i) cin >> nums[i];
  int x = n;
  for (int i = 1; i <= n; ++i) {
    if (nums[i] < x) {
      cout << "                  " << endl;
      occured[nums[i]] = 1;
    } else {
      occured[nums[i]] = 1;
      for (int j = nums[i]; j > 0; j--) {
        if (occured[j] == 1) {
          cout << j << " ";
          x--;
        } else {
          cout << endl;
          break;
        }
      }
    }
  }
  return 0;
}
