#include using namespace std; int kado( int x, int y, int z ){ if( x == y or y == z or z == x ) return 0; if( not ( min( { x, y, z } ) == y or max( { x, y, z } ) == y ) ) return 0; return 1; } tuple< int, int, int > dfs( const vector< int > &a ){ if( a.empty() ) return make_tuple( -1, -1, -1 ); for( int i = 0; i < a.size(); ++i ) for( int j = i + 1; j < a.size(); ++j ) for( int k = j + 1; k < a.size(); ++k ) if( kado( a[ i ], a[ j ], a[ k ] ) ){ vector< int > t = a; t.erase( remove( t.begin(), t.end(), a[ i ] ), t.end() ); t.erase( remove( t.begin(), t.end(), a[ j ] ), t.end() ); t.erase( remove( t.begin(), t.end(), a[ k ] ), t.end() ); tuple< int, int, int > u = dfs( t ); if( get< 0 >( u ) == -1 ) return make_tuple( i, j, k ); } return make_tuple( -1, -1, -1 ); } signed main(){ int N; cin >> N; vector< int > A( N ); for( int i = 0; i < N; ++i ) cin >> A[ i ]; int a, b, c; tie( a, b, c ) = dfs( A ); if( a == -1 ) cout << a << endl; else cout << a << " " << b << " " << c << endl; return 0; }