import copy n = int(input()) k = [int(x) for x in input().split()] def are_kadomatsu(x,y,z): if x == y or y == z or z == x: return False elif x < y < z or x > y > z: return False return True def hand(num_list): num = len(num_list) hand_list = [] for a in range(num): for b in range(a+1, num): for c in range(b+1, num): if are_kadomatsu(num_list[a], num_list[b], num_list[c]): hand_list.append((a, b, c)) return hand_list def game(num_list): result = () if hand(num_list): for (a,b,c) in hand(num_list): ls = copy.copy(num_list) ls.pop(a) ls.pop(b-1) ls.pop(c-2) if not hand(ls): result = (a,b,c) break else: for (a,b,c) in hand(ls): ls2 = copy.copy(ls) ls2.pop(a) ls2.pop(b-1) ls2.pop(c-2) if not hand(ls2): result = () break else: result = game(ls2) return result if p:=game(k): a, b, c = p print(a, b, c) else: print(-1)