N = int(raw_input()) ans = [0] * 10 for i in range(N): r = raw_input().split() s = [int(x) for x in r[:4]] if r[4] == "NO": ans[s[0]] = -1 ans[s[1]] = -1 ans[s[2]] = -1 ans[s[3]] = -1 elif r[4] == "YES": ans[s[0]] += 1 ans[s[1]] += 1 ans[s[2]] += 1 ans[s[3]] += 1 print ans.index(max(ans))