#include using namespace std; #define GET_MACRO(a, b, c, NAME, ...) NAME #define rep(...) GET_MACRO(__VA_ARGS__, rep3, rep2)(__VA_ARGS__) #define rep2(i, a) rep3 (i, 0, a) #define rep3(i, a, b) for (int i = (a); i < (b); i++) #define repr(...) GET_MACRO(__VA_ARGS__, repr3, repr2)(__VA_ARGS__) #define repr2(i, a) repr3 (i, 0, a) #define repr3(i, a, b) for (int i = (b) - 1; i >= (a); i--) template inline bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); } template inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } using ll = long long; int n; int a[12]; bool reg[1 << 12]; tuple dp[1 << 12]; const int inf = 1e9; bool kadomatsu(int x, int y, int z) { if (x == y || y == z || x == z) return false; if (x < y && y > z) return true; if (x > y && y < z) return true; return false; } tuple f(int s) { if (reg[s]) return dp[s]; tuple ret { inf, inf, inf }; rep(i, n) rep(j, i + 1, n) rep(k, j + 1, n) { if (s & 1 << i) continue; if (s & 1 << j) continue; if (s & 1 << k) continue; if (kadomatsu(a[i], a[j], a[k])) { auto val = f(s | (1 << i) | (1 << j) | (1 << k)); if (get<0>(val) == inf) { chmin(ret, make_tuple(i, j, k)); } } } dp[s] = ret; reg[s] = true; return ret; } int main() { rep(i, 1 << 12) reg[i] = false; cin >> n; rep(i, n) cin >> a[i]; auto ans = f(0); if (get<0>(ans) == inf) { cout << -1 << endl; } else { int x, y, z; tie(x, y, z) = ans; cout << x << " " << y << " " << z << endl; } return 0; }