#include using namespace std; #define FOR(i, f, t) for(int(i)=(f);(i)<(t);++(i)) #define REP(i, n) FOR(i, 0, n) #define EACH(it, c) for(auto it=(c).begin();it!=(c).end();++it) bool isKadomatsuSequence(int a, int b, int c){ if(a == b || a == c || b == c) return false; if(b == max(max(a,c),b) || b == min(min(a,c),b)) return true; return false; } int N,K[20]; char memo[1<<20]; vector >v; int dfs(int bit, int plr, int &a, int &b, int &c){ if(memo[bit] != -1) return !!memo[bit]; int res = 0; EACH(it,v){ int i = it->at(0), j = it->at(1), k = it->at(2); int msk = 1<> N; REP(i,N) cin >> K[i]; memset(memo, -1, sizeof(memo)); REP(i,N-2)FOR(j,i+1,N-1)FOR(k,j+1,N){ if(isKadomatsuSequence(K[i],K[j],K[k])){ array ar = {i,j,k}; v.push_back(ar); } } int i,j,k; if(dfs(0,0,i,j,k)){ cout << i << " " << j << " " << k << endl; } else { cout << -1 << endl; } }