# 自分のターンの選択によって次の相手のターンが全て負けに向かえば勝ち # 自分のターンの選択によって次の相手のターンが1つでも勝ちに向かえば負け # LISTの盤面で手番の人が勝つなら勝ち手、負けるなら-1 N = int(input()) K = list(map(int, input().split())) import sys sys.setrecursionlimit(10**7) def dfs(LIST): L = len(LIST) if L < 3: return -1 for a in range(L): for b in range(a+1, L): for c in range(b+1, L): temp = [LIST[a], LIST[b], LIST[c]] if len(set(temp)) != 3: continue if min(temp) != temp[1] and max(temp) != temp[1]: continue remaining = [] for i in range(L): if i != a and i != b and i != c: remaining.append(LIST[i]) if dfs(remaining) == -1: return [a, b, c] # 次の手番が負けるという場合がない=今の手番が負ける return -1 ans = dfs(K) if ans == -1: print(-1) else: print(*ans)