#!/usr/bin/env python3 # -*- coding: utf-8 -*- import collections import itertools IMPOSSIBLE = [-1] def is_kadomatsu(triplet): a, b, c = triplet.values() if a == b or b == c or c == a: return False elif b == max(a, b, c) or b == min(a, b, c): return True else: return False def judge(sequence): if len(sequence) < 3: return IMPOSSIBLE else: for t_triplet in itertools.combinations(sequence.items(), 3): triplet = collections.OrderedDict(t_triplet) if not is_kadomatsu(triplet): continue else: rest_sequence = collections.OrderedDict( p for p in sequence.items() if p[0] not in triplet) result = judge(rest_sequence) if result == IMPOSSIBLE: return triplet else: continue else: return IMPOSSIBLE if __name__ == "__main__": n = int(input()) ks = collections.OrderedDict(enumerate(map(int, input().split()))) print(*judge(ks))