n = int(input()) t = list(range(10)) ans = [0] * 10 for i in range(n): a, b, c, d, r = input().split() a = int(a) b = int(b) c = int(c) d = int(d) if r == "NO": ans[a] -= 1 ans[b] -= 1 ans[c] -= 1 ans[d] -= 1 else: ans[a] += 1 ans[b] += 1 ans[c] += 1 ans[d] += 1 print(ans.index(max(ans)))