#include #include #include #include #include using namespace std; int main() { vector v(10, 1); vector a(4); int N; string s; cin >> N; while (N--) { for (auto &x : a) { cin >> x; } cin >> s; if (s == "YES") { for (auto &x : a) { if (v[x] != 0) { v[x]++; } } } else { for (auto &x : a) { v[x] = 0; } } } int max = 0; int ans = -1; for (int i = 0; i < 10; i++) { if (v[i] > max) { max = v[i]; ans = i; } } cout << ans << endl; }