N = int(input()) L = [6] * 10 for _ in range(N): I = input().split() if I[-1] == 'NO': for i in range(4): L[int(I[i])] -= 6 else: for i in range(4): L[int(I[i])] += 1 print(L.index(max(L)))