#include #include #include #include #include #include #include #define MAX_N 10 int point_table[MAX_N]; int main(){ int n; int* a; int* b; int* c; int* d; std::cin >> n; a =(int*)malloc(sizeof(int)*n); b =(int*)malloc(sizeof(int)*n); c =(int*)malloc(sizeof(int)*n); d =(int*)malloc(sizeof(int)*n); std::vector r; std::string str; for(register int i = 0; i < n; i++){ std::cin >> a[i] >> b[i] >> c[i] >> d[i] >> str; r.push_back(str); } for(register int i =0; i < MAX_N; i++){ point_table[i] = 1; } //init for(register int i = 0; i < n; i++){ if(r[i] == "NO"){ point_table[a[i]]*=0; point_table[b[i]]*=0; point_table[c[i]]*=0; point_table[d[i]]*=0; } else{ point_table[a[i]]*=2; point_table[b[i]]*=2; point_table[c[i]]*=2; point_table[d[i]]*=2; } } int tmp = -1; int tmp_val = -1; for(register int i =0; i < MAX_N; i++){ if(point_table[i] > tmp){ tmp = point_table[i]; tmp_val = i; } } std::cout << tmp_val << std::endl; }