import sys from collections import defaultdict try: import mydebug def dprint(*objects): print(*objects) except: def dprint(*objects, sep='', end='\n'): pass n = int(input()) l = [0, 0, 0, 0] dic = defaultdict(int) for i in range(1, 10): dic[i] = 0 for i in range(n): a, b, c, d, r = input().split() dprint(a,b,c,d,r) if "YES" in r: diff = 1 else: diff = -1 dic[int(a)] += diff dic[int(b)] += diff dic[int(c)] += diff dic[int(d)] += diff maxn = -20000000 ans = -2000 for k, v in dic.items(): if maxn < dic[k]: maxn = dic[k] ans = k print(ans)