import java.util.ArrayList; import java.util.Scanner; public class Main { static int N; static int list[]; static boolean flag[]; static ArrayList matchList = new ArrayList(); static boolean win = false; public static void main(String[] args) { Scanner scan = new Scanner(System.in); N = scan.nextInt(); list = new int[N]; flag = new boolean[N]; for(int i=0; i used = new ArrayList<>(); int turn = 0; solve(used, turn, 0); if(win) { System.out.println(matchList.get(0)); } else { System.out.println("-1"); } } static void solve(ArrayList used, int turn, int firstI) { if(win) return; if(used.size() == 3) { if(check(used)) { if(turn==0) { int count = matchList.size(); if(count == 1 || count == 3) { win = true; return ; } matchList = new ArrayList(); } matchList.add(used.get(0) + " " + used.get(1) + " " + used.get(2)); solve(new ArrayList(), turn+1, 0); } return; } for(int i=firstI; i used) { int values[] = new int[3]; int min = Integer.MAX_VALUE; int max = 0; for(int i=0; i<3; i++) { values[i] = list[used.get(i)]; min = Math.min(min, values[i]); max = Math.max(max, values[i]); } int A = values[0]; int B = values[1]; int C = values[2]; if(A != B && A != C && B != C) { if((min == A && max == B) || (min == C && max == B) || (min == B && max == C) || (min == B && max == A) ) { return true; } } return false; } }