n = gets.to_i result = n.times.map { q = gets.chomp.split yes_or_no = q.pop == "YES" [q.map(&:to_i),yes_or_no] }.each_with_object(Array.new(10, 0)) { |(nums, yes_or_no),o| if yes_or_no nums.each {|i| o[i] += 1 } else nums.each {|i| o[i] -= 1 } end } max = result.max puts result.find_index(max)