import java.util.Arrays; import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int [][]x = new int[N][4]; String []s = new String[N]; for(int i = 0; i < N; i++) { for(int j = 0; j < 4; j++) { x[i][j] = scan.nextInt(); } s[i] = scan.next(); } scan.close(); int []state = new int[10]; Arrays.fill(state, 0); int k = 0; for(int i = 0; i < N; i++) { if(s[i].equals("YES")) { k = 1; }else { k = -1; } for(int j = 0; j < 4; j++) { state[x[i][j]] += k; } } int max = state[0]; int ans = 0; for(int i = 1; i < 10; i++) { if(max < state[i]) { ans = i; max = state[i]; } } System.out.println(ans); } }