// Guilherme A. Pinto, OBI-2018, campeonato #include using namespace std; string fase[4] {"final", "semifinal", "quartas", "oitavas" }; int A, B; string chave( int f, int lo, int hi ){ // base if ( f == 3 ) return fase[f]; // recursao int mid = lo+(hi-lo)/2; if ( A <= mid and B > mid ) return fase[f]; if ( B <= mid ) return chave( f+1, lo, mid ); return chave( f+1, mid+1, hi ); } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int j; for( int i = 1; i <= 16; i++ ){ cin >> j; if ( j == 1 ) A = i; if ( j == 9 ) B = i; } if ( A > B ) swap( A, B ); cout << chave( 0, 1, 16 ) << endl; return 0; }