#include <bits/stdc++.h>
const long long oo = (long long)1e18;
using namespace std;
int n;
bool f[100005];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  int bg = n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    f[x] = true;
    while (bg > 0 && f[bg]) {
      cout << bg << " ";
      bg--;
    }
    cout << "\n";
  }
  return 0;
}
