yes = [1 for _ in range(10)] no = [0 for _ in range(10)] n = int(input()) for i in range(n): data = list(map(str, input().split())) if data[4] =='YES': for number in data[0:4]: yes[int(number)] += 1 else: for number in data[0:4]: no[int(number)] += 1 for i, n in enumerate(no): if n > 0: yes[i] = 0 pos = yes.index(max(yes)) print(pos)