#include <bits/stdc++.h>
using namespace std;
long long pow(int a, int b, long long MOD) {
  long long x = 1, y = a;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x * y);
      if (x > MOD) x %= MOD;
    }
    y = (y * y);
    if (y > MOD) y %= MOD;
    b /= 2;
  }
  return x;
}
long long InverseEuler(int n, long long MOD) { return pow(n, MOD - 2, MOD); }
int hcf(int n1, int n2) {
  if (n2 != 0)
    return hcf(n2, n1 % n2);
  else
    return n1;
}
int main() {
  int n;
  cin >> n;
  int a[100002];
  map<int, int> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  int t = n;
  for (int i = 0; i < n; i++) {
    if (a[i] == t) {
      cout << t << " ";
      t--;
      while (m[t] != 0) {
        if (m[t] == 1) cout << t << " ";
        t--;
      }
      cout << endl;
    } else {
      m[a[i]] = 1;
      cout << endl;
    }
  }
}
