n = int(input()) p = [0 for _ in range(10)] for _ in range(n): tmp = input() tmp = tmp.rsplit(' ',1) num_list = [int(x) for x in tmp[0].split()] if tmp[1] == "YES": for x in range(10): if x in num_list: pass else: p[x] = -1 elif tmp[1] == "NO": for x in num_list: p[x] = -1 print(p.index(0))