#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) #define all(c) (c).begin(), (c).end() #define zero(a) memset(a, 0, sizeof a) #define minus(a) memset(a, -1, sizeof a) template inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); } template inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); } typedef long long ll; int const inf = 1<<29; int N; int A[15]; bool kadomatsu(int a, int b, int c) { if(!(A[a] != A[b] && A[b] != A[c] && A[c] != A[a])) { return false; } if(A[b] < A[a] && A[b] < A[c]) { return true; } if(A[b] > A[a] && A[b] > A[c]) { return true; } return false; } bool dfs(set& used) { bool win = 0; rep(i, N) REP(j, i+1, N) REP(k, j+1, N) { if(used.count(i) || used.count(j) || used.count(k)) { continue; } if(kadomatsu(i, j, k)) { used.insert(i); used.insert(j); used.insert(k); win = win || !dfs(used); used.erase(i); used.erase(j); used.erase(k); } } return win; } int main() { cin >> N; rep(i, N) { cin >> A[i]; } vector res = {inf, inf, inf}; bool win = 0; rep(i, N) REP(j, i+1, N) REP(k, j+1, N) { if(kadomatsu(i, j, k)) { set used; used.insert(i); used.insert(j); used.insert(k); if(!dfs(used)) { win = 1; res = min(res, {i, j, k}); } } } if(win) { cout << res[0] << " " << res[1] << " " << res[2] << endl; } else { cout << "-1\n"; } return 0; }