yes=[0]*10 no=[0]*10 Y=0 N=0 n=int(input()) for i in range(n): a=list(map(str,input().split())) if a[-1]=="NO": N+=1 for j in a[:-1]: no[int(j)]+=1 else: Y+=1 for j in a[:-1]: yes[int(j)]+=1 if Y==0: print(no.index(0)) elif N==0: print(yes.index(2)) else: for i in range(10): if yes[i]==2 and no[i]==0: print(i) exit()