#include <bits/stdc++.h>
using namespace std;
long long n, k, a[1000000], m, cnt, ans, x, y;
long long c[1000000];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  long long mn = n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    c[a[i]]++;
    if (a[i] == mn) {
      while (c[mn] != 0) {
        cout << mn << ' ';
        mn--;
      }
    }
    cout << "\n";
  }
  return 0;
}
