# dfs #門松列は3個の長さすべてが違う必要ある N = int(input()) K = list(map(int, input().split())) import sys sys.setrecursionlimit(10**7) def dfs(LIST): #print('LIST', LIST) L = len(LIST) if L < 3: return -1 for i in range(L): for j in range(i+1, L): for k in range(j+1, L): temp = [LIST[i], LIST[j], LIST[k]] if len(set(temp)) == 3: #門松列は3個の長さすべてが違う必要ある if max(temp) == LIST[j] or min(temp) == LIST[j]: new_LIST = [] for l in range(L): if l not in [i, j, k]: new_LIST.append(LIST[l]) if dfs(new_LIST) == -1: return [i, j, k] return -1 ans = dfs(K) if ans == -1: print(-1) else: print(*ans)