import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No0024 { public static void main(String[] args) { try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { int cntTurn = Integer.parseInt(br.readLine()); String[] str; int collectCnt = 0; int[] num = new int[10]; for (int i = 0; i < cntTurn; i++) { str = br.readLine().trim().split(" "); if (str[str.length - 1].endsWith("NO")) { for (int j = 0; j < str.length - 1; j++) { num[Integer.parseInt(str[j])] = -1;// ăƒȘă‚»ăƒƒăƒˆ } } else if (str[str.length - 1].endsWith("YES")) { for (int j = 0; j < str.length - 1; j++) { num[Integer.parseInt(str[j])] += 1; } collectCnt++; } } for (int i = 0; i < num.length; i++) { if (num[i] == collectCnt) { System.out.println(i); } } } catch (IOException e) { e.printStackTrace(); } } }