def isKDMT(X): return len(set(X))==3 and(min(X)==X[1] or max(X)==X[1]) N=input() K=map(int,raw_input().split()) win=[] def solve(k,l,d=0): global win for a in range(N): if k[a]==0:continue for b in range(a+1,N): if k[b]==0:continue for c in range(b+1,N): if k[c]==0:continue if isKDMT([k[a],k[b],k[c]]): n=k[:] n[a]=n[b]=n[c]=0 r=solve(n,l-3,d+1) if r==False: if d==0: print a,b,c return True return False if not solve(K,N):print -1