n = int(input()) a = [list(input().split()) for i in range(n)] w = [0] * 10 for j in range(n): idx = 1 if a[j].pop() == "YES" else -1 for elem in a[j]: w[int(elem)] += idx print(w.index(max(w)))