#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int arr[N];
int main() {
  int n;
  memset(arr, 0, sizeof arr);
  cin >> n;
  int maxx = n;
  int num;
  for (int i = 0; i < n; i++) {
    cin >> num;
    arr[num] = -1;
    while (arr[maxx] == -1) {
      cout << maxx << " ";
      maxx -= 1;
    }
    cout << endl;
  }
  return 0;
}
