require 'set' count = gets.to_i i = gets.chomp.split("\n").map{|a| a.split(" ")} candidates = ("0".."9").to_set i.each do |a| if a.last == "YES" candidates = candidates.intersection a else candidates = candidates.difference a end end puts candidates.first