#include <bits/stdc++.h>
using namespace std;

int main() { 
  int n, b_, ans = 0;
  vector<int> a, b;
  cin >> n;
  for(int i = 0; i < n; ++i) {
    cin >> b_;
    b.push_back(b_);
  }
  while(b.size()) {
    for(int i = b.size()-1; i >= 0; --i) {
      if(b[0] != 1) {
        cout << -1 << '\n';
        return 0;
      }
      if(b[i] == i+1) {
        a.push_back(b[i]);
        b.erase(b.begin()+i);
        break;
      }
    }
  }
  for(int i = n-1; i >= 0; --i) {
    cout << a[i] << '\n';
  }
}
