package yukicoder; import java.util.Scanner; public class Yuki24_{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int num = scan.nextInt(); int arr[][] = new int[num][4]; String[] ans = new String[num]; int numbers[] = new int[10]; for (int i = 0; i < num; i++ ) { for (int j = 0; j < 4; j++ ) { arr[i][j] = scan.nextInt(); } ans[i] = scan.next(); } scan.close(); for (int i = 0; i < num; i++ ) { for (int j = 0; j < 4; j++ ) { if("YES".equals(ans[i])){ numbers[arr[i][j]] += 1; } if("NO".equals(ans[i])){ numbers[arr[i][j]] -= 1; } } } int jug = 0; for(int i = 0 ;i <= 9; i++ ) { if(jug <= numbers[i]){ jug = i; } } System.out.println(jug); } }