N = int(input()) A = list(map(int, input().split())) used = [0] * N def valid(a, b, c): return len(set([a, b, c])) == 3 and (min(a, b, c) == b or max(a, b, c) == b) def win(depth): for a in range(N): for b in range(a + 1, N): for c in range(b + 1, N): if used[a] or used[b] or used[c] or not valid(A[a], A[b], A[c]): continue used[a] = used[b] = used[c] = 1 w = not win(depth + 1) used[a] = used[b] = used[c] = 0 if w: if depth == 0: print(a, b, c) return 1 return 0 if not win(0): print(-1)