N = int(input()) L = [1] * 10 for _ in range(N): q = [ i for i in input().split() ] if q[-1] == "NO": for i in q[:-1]: L[int(i)] *= 0 else: for i in q[:-1]: L[int(i)] *= 2 max = 0 ans = 0 for i, l in enumerate(L): if l > max: ans = i max = l print(ans)