# 自力練習 N = int(input()) K = list(map(int, input().split())) import sys sys.setrecursionlimit(10**7) def dfs(LIST): L = len(LIST) for a in range(L): for b in range(a+1, L): for c in range(b+1, L): hand = [LIST[a], LIST[b], LIST[c]] if len(set(hand)) == 3: if max(hand) == hand[1] or min(hand) == hand[1]: new_hand = [] for l in range(L): if l != a and l != b and l != c: new_hand.append(LIST[l]) if dfs(new_hand) == 0: return (a, b, c) return 0 result = dfs(K) if result == 0: print(-1) else: print(*result)