#include <bits/stdc++.h>
using namespace std;
using namespace std;
void solve() {
  long long n;
  cin >> n;
  long long ptr = n;
  long long ct[n + 1];
  memset(ct, 0, sizeof(ct));
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    ct[x] = 1;
    while (ptr > 0 && ct[ptr] == 1) {
      cout << ptr << " ";
      ptr--;
    }
    cout << endl;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
