#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 a(N), b(N), c(N), d(N); vector R(N); REP( i, N ) cin >> a[i] >> b[i] >> c[i] >> d[i] >> R[i]; vector vc( 10, 1 ); REP( i, N ) { if( R[i] == "YES" ) { vc[a[i]] += 1; vc[b[i]] += 1; vc[c[i]] += 1; vc[d[i]] += 1; } if( R[i] == "NO" ) { vc[a[i]] = 0; vc[b[i]] = 0; vc[c[i]] = 0; vc[d[i]] = 0; } } cout << distance( vc.begin(), max_element( vc.begin(), vc.end() ) ) << endl; return 0; }