using System; using System.Collections.Generic; using System.Linq; using System.Text; class yc2 { static void Main() { int N = int.Parse(Console.ReadLine()); int temp; int[] ary = {0,1,2,3,4,5,6,7,8,9}; int[] temps = new int[4]; string[] str1; for (int i = 0; i < N; i++) { str1 = Console.ReadLine().Split(); if (str1[4] == "NO") { for (int j = 0; j < 4; j++) { temp = int.Parse(str1[j]); ary[temp] = -1; } } else { for (int j = 0; j < 4; j++) { temps[j] = int.Parse(str1[j]); } for (int j = 0; j < 10; j++) { if (ary[j] != temps[0] && ary[j] != temps[1] && ary[j] != temps[2] && ary[j] != temps[3]) { ary[j] = -1; } } } } for (int i = 0; i < 10; i++) { if (ary[i] != -1) Console.WriteLine(ary[i]); } } }