import java.util.Arrays; import java.util.Scanner; public class Main{ public static void main(String args[])throws Exception{ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); Boolean[] Yes = new Boolean[10]; Arrays.fill(Yes, true); ; 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")){ for(int j=0;j<10;j++){ if(j!=A&&j!=B&&j!=C&&j!=D){ Yes[j] = false; } } }else{ Yes[A] = false; Yes[B] = false; Yes[C] = false; Yes[D] = false; } } for(int i=0;i<10;i++){ if(Yes[i]){ System.out.println(i); } } } }