#include #define REP(i,a) for(int i = 0; i < a; i++) using namespace std; int main () { int nums[10] = {0}; // 0~9の数字, YESの時1を足し、NOの時1を引く int res[4] = {}; // 提示する4つの数字 int N; cin >> N; REP (i, N) { REP (i, 4) cin >> res[i]; string s; cin >> s; REP (i, 4) { if (s == "YES") nums[res[i]]++; else nums[res[i]]--; } } int max = -100, cnt = -100; REP (i, 10) { if (cnt < nums[i]) { max = i; cnt = nums[i]; } } cout << max << endl; return 0; }