n, y = [], [] c = 0 for i in range(int(input())): l = input().split() if l[4] == "NO": n += l[:-1] else: y += l[:-1] c += 1 s = "".join([x for x in set(y) if y.count(x) == c]) if c else "0123456789" for i in s: if not i in n : print(i)