N=int(raw_input()) A=[int(raw_input()) for i in range(N)] Ans=[-1 for i in range(N)] for i in range(N): m,k=-1,-1 for j,a in enumerate(A): if Ans[j]==-1 and a!=i and a>m: m,k=a,j if m==-1: print -1 exit() Ans[k]=i for a in Ans: print a