Niwango has N cards, numbered 1,2,\ldots,N. He will now arrange these cards in a row.

Niwango wants to know if there is a way to arrange the cards while satisfying all the N conditions below. To help him, determine whether such a way exists. If the answer is yes, also find the lexicographically smallest such arrangement.

* To the immediate right of Card 1 (if any) is NOT Card a_1.
* To the immediate right of Card 2 (if any) is NOT Card a_2.
* \vdots
* To the immediate right of Card N (if any) is NOT Card a_N.

Constraints

* 2 \leq N \leq 10^{5}
* 1 \leq a_i \leq N
* a_i \neq i

Input

Input is given from Standard Input in the following format:


N
a_1 a_2 \ldots a_N


Output

If no arrangements satisfy the conditions, print `-1`. If such arrangements exist, print the lexicographically smallest such arrangement, in the following format:


b_1 b_2 \ldots b_N


Here, b_i represents the i-th card from the left.

Examples

Input

4
2 3 4 1


Output

1 3 2 4


Input

2
2 1


Output

-1


Input

13
2 3 4 5 6 7 8 9 10 11 12 13 12


Output

1 3 2 4 6 5 7 9 8 10 12 11 13
import sys
input = sys.stdin.readline

N=int(input())
A=[0]+list(map(int,input().split()))

if N==2 and A==[0,2,1]:
    print(-1)
    sys.exit()


C=[0]*(N+1)

for i in range(1,N+1):
    if A[i]!=i:
        C[A[i]]+=1

import heapq

H=[]
for i in range(1,N+1):
    H.append((-C[i],i))

heapq.heapify(H)
NOUSE=list(range(N,0,-1))
USELIST=[0]*(N+1)
ANS=[0]

for rest in range(N-1,2,-1):
    #print(ANS,NOUSE,H,rest)
    
    if -H[0][0]==rest and rest!=0:
        x,y=heapq.heappop(H)
        ANS.append(y)
        C[y]=0
        C[A[y]]-=1
        USELIST[y]=1

    else:
        for i in range(len(NOUSE)-1,-1,-1):
            if USELIST[NOUSE[i]]==0 and A[ANS[-1]]!=NOUSE[i]:
                x=NOUSE.pop(i)
                ANS.append(x)
                USELIST[x]=1
                C[x]=0
                C[A[x]]-=1
                break
            

    while C[H[0][1]]!=-H[0][0]:
        x,y=heapq.heappop(H)
        heapq.heappush(H,(-C[y],y))

    while NOUSE and USELIST[NOUSE[-1]]==1:
        NOUSE.pop()


NOUSE=[i for i in range(N+1) if USELIST[i]==0]

from itertools import permutations
REST=list(permutations(sorted(NOUSE[1:])))

if len(REST)==2:
    for x,y in REST:
        if A[ANS[-1]]!=x and A[x]!=y:
            ANS.extend([x,y])
            break

else:    
    for x,y,z in REST:
        if A[ANS[-1]]!=x and A[x]!=y and A[y]!=z:
            ANS.extend([x,y,z])
            break

print(*ANS[1:])