#include int main(void){ //nの読み込み int n; scanf("%d",&n); //abcdrの読み込み int i; struct table{ int a; int b; int c; int d; char r[30]; }tab[n]; for(i = 0 ; i < n ; i++){ scanf("%d %d %d %d %s", &tab[i].a, &tab[i].b, &tab[i].c, &tab[i].d, tab[i].r); } //次郎君を求める int max,x; int aaa[10]; max = 0; for(i = 0 ; i < n ; i++){ if(tab[i].r[1] == 'Y'){ aaa[tab[i].a]++; aaa[tab[i].b]++; aaa[tab[i].c]++; aaa[tab[i].d]++; } if(tab[i].r[1] == 'N'){ aaa[tab[i].a] -= 6; aaa[tab[i].b] -= 6; aaa[tab[i].c] -= 6; aaa[tab[i].d] -= 6; } } for(i = 0 ; i < 10 ; i++){ if(aaa[i] > max){ max = aaa[i]; x = i; } } //表示 printf("%d\n", x); return 0; }