#include #include int main(){ int N, i, j, cnt_y = 0, cnt_n = 0, num[6][4]; char str[6][4]; int YES[11] = {0}, NO[11] = {0}; scanf("%d\n", &N); for(i = 0; i < N; i++){ scanf("%d %d %d %d %s\n", &num[i][0], &num[i][1], &num[i][2], &num[i][3], str[i]); } for(i = 0; i < N; i++){ for(j = 0; j < 4; j++){ if(strcmp(str[i], "YES") == 0){ YES[num[i][j]]++; }else if(strcmp(str[i], "NO") == 0){ NO[num[i][j]]++; } } if(strcmp(str[i], "YES") == 0) cnt_y++; if(strcmp(str[i], "NO") == 0) cnt_n++; } //printf("cnt_y %d cnt_no %d\n", cnt_y, cnt_n); for(i = 1; i <= 9; i++){ if(YES[i] == cnt_y && NO[i] == 0){ printf("%d\n", i); } } return 0; }