def main(): N = int(input()) yes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] no = [] for i in range(N): s = input() if s[8] == 'N': no += list(map(int, s[0:7].split(' '))) else: yes += list(map(int, s[0:7].split(' '))) print(list(set(yes) - set(no))[0]) if __name__ == '__main__': main()