#include #include using namespace std; int main() { int n; int a[10][4]; string s[10]; int cnt[10] = {}; int max = 0; int sub; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3] >> s[i]; } for (int i = 0; i < n; i++) { if (s[i] == "YES") { cnt[a[i][0]]++; cnt[a[i][1]]++; cnt[a[i][2]]++; cnt[a[i][3]]++; } else { cnt[a[i][0]]--; cnt[a[i][1]]--; cnt[a[i][2]]--; cnt[a[i][3]]--; } } for (int i = 0; i < 9; i++) { if (cnt[i] > max) { max = cnt[i]; sub = i; } } cout << sub << endl; }