def main(): N = int(input()) A = tuple(tuple(input().split()) for _ in range(N)) num = [0] * 10 for x in A: if x[-1] == 'YES': for i in range(4): num[int(x[i])] += 1 else: for i in range(4): num[int(x[i])] -= 1 ans = num.index(max(num)) print(ans) main()