#include #define REP(i,n) for(int i=0; i<(n); i++) using namespace std; struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star; int main() { int N; cin >> N; vector res( 10, 1 ); REP( i, N ) { vector vc(N); REP( j, 4 ) { cin >> vc[j]; } string R; cin >> R; REP( j, 4 ) { if( R == "YES" ) { res[vc[j]] += 1; } if( R == "NO" ) { res[vc[j]] = 0; } } } cout << distance( res.begin(), max_element( res.begin(), res.end() ) ) << endl; return 0; }