N = input() nList = [] yList = [] r = ['0','1','2','3','4','5','6','7','8','9'] c = 0 for i in range(int(N)): L = list(input().split()) if 'NO' in L: nList.extend(L) else: yList.extend(L) c = yList.count('YES') for n in nList: if n in r: r.remove(n) if len(r) == 1: print(r[0]) else: wList = [x for x in set(r) if yList.count(x) > c - 1] for w in wList: if w in r: print(w)