using System; using System.Linq; namespace No024_数当てゲーム { class Program { static void Main(string[] args) { int[] yes = Enumerable.Repeat(1, 10).ToArray(); int[] no = Enumerable.Repeat(0, 10).ToArray(); int max = 0, pos = 0; int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { string[] input = Console.ReadLine().Split(' '); if (input[4] == "YES") for (int j = 0; j < 4; j++) yes[int.Parse(input[j])]++; else for (int j = 0; j < 4; j++) no[int.Parse(input[j])]++; } for (int i = 0; i < 10; i++) { if (no[i] > 0) yes[i] = 0; if (max < yes[i]) { max = yes[i]; pos = i; } } Console.WriteLine(pos.ToString()); } } }