from collections import Counter def main(): N = int(input()) num = [] for x in range(N): A,B,C,D,R = input().split() if R == 'YES': num.append(int(A)) num.append(int(B)) num.append(int(C)) num.append(int(D)) cnt = Counter(num) cnt = max([(v,k) for k,v in cnt.items()])[1] print(cnt) if __name__ == '__main__': main()