using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ProgrammingContest { class MainClass { Scanner sc; static void Main(string[] args) { new MainClass().Solve(); } void Solve() { #if DEBUG string backPath = ".."; char dirSep = System.IO.Path.DirectorySeparatorChar; string inFilePath = backPath + dirSep + backPath + dirSep + "in.txt"; sc = new Scanner(new System.IO.StreamReader(inFilePath)); #else sc = new Scanner(); #endif N = sc.NextInt; K = new int[N].Select(e => sc.NextInt).ToArray(); var ans = dfs(0, true); if (ans) { Write(ansVals.Item1 + " " + ansVals.Item2 + " " + ansVals.Item3); } else { Write(-1); } } int N; int[] K; Tuple ansVals = Tuple.Create(22, 22, 22); bool dfs(int now, bool isFirst) { bool isWin = false; for (int i = 0; i < N; i++) { for (int j = i + 1; j < N; j++) { for (int k = j + 1; k < N; k++) { if ((now & ((1 << i) | (1 << j) | (1 << k))) == 0) { int[] ar = new int[] { K[i], K[j], K[k] }; Array.Sort(ar); if ((ar[1] == K[i] || ar[1] == K[k]) && ar[0] != ar[1] && ar[1] != ar[2]) { bool buf = dfs(now | ((1 << i) | (1 << j) | (1 << k)), !isFirst); if (!buf) { var bufVals = Tuple.Create(i, j, k); if (now == 0 && comp(bufVals, ansVals) < 0) { ansVals = bufVals; } isWin = true; } } } } } } return isWin; } int comp(Tuple a, Tuple b) { if (a.Item1 < b.Item1) { return -1; } else if (a.Item1 == b.Item1) { if (a.Item2 < b.Item2) { return -1; } else if (a.Item2 == b.Item2) { if (a.Item3 < b.Item3) { return -1; } else if (a.Item3 == b.Item3) { return 0; } else { return 1; } } else { return 1; } } else { return 1; } } void Write(object val) { Console.WriteLine(val.ToString()); } void Write(string format, params object[] vals) { Console.WriteLine(format, vals); } } class Scanner { Queue buffer; char[] sep; System.IO.TextReader reader; public Scanner(System.IO.TextReader reader = null) { this.buffer = new Queue(); this.sep = new char[] { ' ' }; this.reader = (reader ?? Console.In); } private void CheckBuffer() { if (this.buffer.Count == 0 && this.reader.Peek() >= 0) { string[] sreArray = this.reader.ReadLine().Split(this.sep); foreach (String elStr in sreArray) { this.buffer.Enqueue(elStr); } } } public String Next { get { this.CheckBuffer(); return this.buffer.Dequeue(); } } public int NextInt { get { return int.Parse(this.Next); } } public double NextDouble { get { return double.Parse(this.Next); } } public long NextLong { get { return long.Parse(this.Next); } } public bool IsEmpty { get { this.CheckBuffer(); return this.buffer.Count == 0; } } } }