#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	vector<ll>a;
	cin>>n;
	for(int i=0;i<n;i++){
		ll x;
		cin>>x;
		a.push_back(x);
	}
	vector<ll>b;
	ll m=n;
	for(int i=n-1;i>=0;i--){
		if(a[i]==i+1){
			b.push_back(a[i]);
			a.erase(a.begin()+i);
			m--;
			i=m;
			continue;
		}
		if(i==0){
		cout << -1;
		return 0;
		}
	}
	for(int i=n-1;i>=0;i--){
		cout << b[i]<<endl;
	}
	return 0;
}