#! ruby # yukicoder My Practice # author: Leonardone @ NEETSDKASU N = gets.to_i enables = ('0'..'9').to_a N.times do *abcd, r = gets.chomp.split if r == 'NO' enables -= abcd else enables &= abcd end end puts enables.first