n = int(input()) l = [[str(i), 1] for i in range(10)] m = dict(l) for i in range(n): a, b, c, d , r = input().split() if r == 'YES': m[a] += 1 m[b] += 1 m[c] += 1 m[d] += 1 else: m[a] = 0 m[b] = 0 m[c] = 0 m[d] = 0 print(max(m, key=m.get))