Given an array a of length n, find another array, b, of length n such that:

  * for each i (1 ≤ i ≤ n) MEX(\\{b_1, b_2, …, b_i\})=a_i. 



The MEX of a set of integers is the smallest non-negative integer that doesn't belong to this set.

If such array doesn't exist, determine this.

Input

The first line contains an integer n (1 ≤ n ≤ 10^5) — the length of the array a.

The second line contains n integers a_1, a_2, …, a_n (0 ≤ a_i ≤ i) — the elements of the array a. It's guaranteed that a_i ≤ a_{i+1} for 1≤ i < n.

Output

If there's no such array, print a single line containing -1.

Otherwise, print a single line containing n integers b_1, b_2, …, b_n (0 ≤ b_i ≤ 10^6)

If there are multiple answers, print any.

Examples

Input


3
1 2 3


Output


0 1 2 

Input


4
0 0 0 2


Output


1 3 4 0 

Input


3
1 1 3


Output


0 2 1 

Note

In the second test case, other answers like [1,1,1,0], for example, are valid.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
#define int ll
#define mod 998244353
#define gcd(m,n) __gcd(m, n)
#define rep(i , j , n) for(int i = j ; i <= n ; i++)
#define red(i , n , j)  for(int i = n ; i >= j ; i--)
#define ME(x , y) memset(x , y , sizeof(x))
int lcm(int a , int b){return a*b/gcd(a,b);}
ll quickpow(ll a , ll b){ll ans=1;while(b){if(b&1)ans=ans*a%mod;b>>=1,a=a*a%mod;}return ans;}
//int euler1(int x){int ans=x;for(int i=2;i*i<=x;i++)if(x%i==0){ans-=ans/i;while(x%i==0)x/=i;}if(x>1)ans-=ans/x;return ans;}
//const int N = 1e7+9; int vis[n],prime[n],phi[N];int euler2(int n){ME(vis,true);int len=1;rep(i,2,n){if(vis[i]){prime[len++]=i,phi[i]=i-1;}for(int j=1;j<len&&prime[j]*i<=n;j++){vis[i*prime[j]]=0;if(i%prime[j]==0){phi[i*prime[j]]=phi[i]*prime[j];break;}else{phi[i*prime[j]]=phi[i]*phi[prime[j]];}}}return len}
#define INF  0x3f3f3f3f
#define PI acos(-1)
#define pii pair<int,int>
#define fi first
#define se second
#define lson l,mid,root<<1
#define rson mid+1,r,root<<1|1
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define size(v) (int)(v.size())
#define cin(x) scanf("%lld" , &x);
const int N = 1e7+9;
const int maxn = 1e5+9;
const double esp = 1e-6;
vector<int>a[maxn];
int vis[maxn];
void solve(){
    int n ;
    cin >> n;
    rep(i , 1 , n-1){
        int u , v ;
        cin >> u >> v ;
        a[u].pb(i);
        a[v].pb(i);
    }
    ME(vis , -1);
    int ans = -1 , ma = -1;
    for(int i = 1 ; i <= n ; i++){
        if(size(a[i]) > 2){
            ma = i ;
            break;
        }
    }
    if(ma != -1){
        for(auto i : a[ma]){
            vis[i] = ++ans;
        }
    }
    rep(i , 1 , n-1){
        if(vis[i] == -1){
            vis[i] = ++ans;
        }
    }
    rep(i , 1 , n-1){
        cout << vis[i] << endl;
    }
}
 
signed main()
{
    //ios::sync_with_stdio(false);
    int t ;
    //scanf("%lld" , &t);
    //while(t--)
        solve();
}