import java.util.*; import java.math.*; import java.io.*; public class Main { static int[] ret = new int[3]; static int[] k; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); k = new int[n]; for(int i = 0; i < n; i++) { k[i] = sc.nextInt(); } boolean ret = dfs(n,new boolean[n],true); if(ret) { System.out.println(Main.ret[0] + " " + Main.ret[1] + " " + Main.ret[2]); } else { System.out.println(-1); } } static boolean dfs(int a, boolean[] use, boolean t) { if(a == 0) return !t; if(a == use.length) { int[] ret = new int[3]; for(int i = 0; i < use.length; i++) { ret[0] = i; for(int j = i+1; j < use.length; j++) { ret[1] = j; for(int k = j+1; k < use.length; k++) { int[] tes = new int[3]; tes[0] = Main.k[i]; tes[1] = Main.k[j]; tes[2] = Main.k[k]; Arrays.sort(tes); if(tes[1] == Main.k[j]) continue; ret[2] = k; use[i] = true; use[j] = true; use[k] = true; if(dfs(a - 3,use,false)) { use[i] = false; use[j] = false; use[k] = false; Main.ret = ret; return true; } use[i] = false; use[j] = false; use[k] = false; } } } return false; } else if(t) { for(int i = 0; i < use.length; i++) { if(use[i]) continue; for(int j = i+1; j < use.length; j++) { if(use[j]) continue; for(int k = j+1; k < use.length; k++) { if(use[k]) continue; int[] tes = new int[3]; tes[0] = Main.k[i]; tes[1] = Main.k[j]; tes[2] = Main.k[k]; Arrays.sort(tes); if(tes[1] == Main.k[j]) continue; use[i] = true; use[j] = true; use[k] = true; if(dfs(a - 3,use,false)) { use[i] = false; use[j] = false; use[k] = false; return true; } use[i] = false; use[j] = false; use[k] = false; } } } return false; } else { boolean ok = true; boolean ret = true; for(int i = 0; i < use.length; i++) { if(use[i]) continue; for(int j = i+1; j < use.length; j++) { if(use[j]) continue; for(int k = j+1; k < use.length; k++) { if(use[k]) continue; int[] tes = new int[3]; tes[0] = Main.k[i]; tes[1] = Main.k[j]; tes[2] = Main.k[k]; Arrays.sort(tes); if(tes[1] == Main.k[j]) continue; ok = true; use[i] = true; use[j] = true; use[k] = true; ret &= dfs(a - 3,use,true); use[i] = false; use[j] = false; use[k] = false; } } } return ret & ok; } } }