#include using namespace std; int main() { int N; cin >> N; vector V(10); for (int i = 0; i < N; i++) { vector tmp(4); for (int i = 0; i < 4; i++) cin >> tmp.at(i); string s; cin >> s; if (s == "NO") for (auto t : tmp) V.at(t)--; else for (auto t : tmp) V.at(t)++; } int mx = *max_element(V.begin(), V.end()); for (int i = 0; i < 10; i++) { if (V.at(i) == mx) return cout << i << "\n", 0; } }