input_list = input().split() possible_list = list(range(0, 10)) for i in range(1, int(input_list[0]) + 1): if input_list[5 * i] == "YES": possible_list = list(set(possible_list) & set(map(int, input_list[(5 * i - 4):(5 * i)]))) elif input_list[5 * i] == "NO": possible_list = list(set(possible_list) - set(map(int, input_list[(5 * i - 4):(5 * i)]))) print(possible_list[0])