#https://yukicoder.me/submissions/219740から書き換え ans = set("0123456789") n = int(input()) for i in range(n): nums, r = input().rsplit(None, 1) nums = set(nums) if r == "YES": ans &= nums else: ans -= nums print("".join(ans))