# 苦手dfs練習 # N小さいので3個を全探索して、門松列になれば、残りを作りまたdfs 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: if max(temp) == LIST[b] or min(temp) == LIST[b]: remaining = [] for l in range(L): if l != a and l != b and l != c: remaining.append(LIST[l]) if dfs(remaining) == -1: return [a, b, c] return -1 ans = dfs(K) if ans == -1: print(-1) else: print(*ans)