box = set() for i in range(10): box.add(i) YES = [0]*10 cnt=0 N = int(input()) for i in range(N): A,B,C,D,R = map(str,input().split()) if R=="NO": if int(A) in box: box.remove(int(A)) if int(B) in box: box.remove(int(B)) if int(C) in box: box.remove(int(C)) if int(D) in box: box.remove(int(D)) else: cnt+=1 YES[int(A)]+=1 YES[int(B)]+=1 YES[int(C)]+=1 YES[int(D)]+=1 for y in range(10): if YES[y]