import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] num = new int[10]; Arrays.fill(num, 0); for(int i = 0; i < N; i++) { int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); int D = sc.nextInt(); String R = sc.next(); if(R.equals("NO")) { num[A]--; num[B]--; num[C]--; num[D]--; } else if(R.equals("YES")) { num[A]++; num[B]++; num[C]++; num[D]++; } } int ans = 0; int max = num[0]; for(int i = 1; i <= 9; i++) { if(max < num[i]) { max = num[i]; ans = i; } } System.out.println(ans); } }