import copy N=int(input()) K=[int(i) for i in input().split()] ans=[] def isWinning(state,depth): nextStates=[] now=state global ans #手の選択 for i in range(N): if now[i]==False: continue for j in range(i+1,N): #a>b and bK[j] and now[j]==True: for m in range(j+1,N): if K[j]c if K[i]K[m] and now[m]==True: nextK=copy.deepcopy(now) nextK[i]=False nextK[j]=False nextK[m]=False nextStates.append(nextK) # print('now',now) # print('next',nextStates) for nextState in nextStates: if not isWinning(nextState,depth+1): if depth==0: # ans.append(copy.deepcopy(nextState)) ans=copy.deepcopy(nextState) # print(ans) return True return False start=[True for i in range(N)] ret=isWinning(start,0) # print(ret) syote=[] for i in range(len(ans)): if ans[i]==False: syote.append(i) syote_string=' '.join(map(str,syote)) out=syote_string if ret==True else -1 print(out)