import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] x = new int[10]; for(int i = 0 ; i < n ; i++) { int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); String e = sc.next(); if(e.equals("YES")) { x[a]++; x[b]++; x[c]++; x[d]++; } else { x[a] -= 100; x[b] -= 100; x[c] -= 100; x[d] -= 100; } } int ans = -1; int point = -1; for(int i = 0 ; i < 10 ; i++) { if(x[i] > point) { ans = i; point = x[i]; } } System.out.println(ans); } }