fun main() { val N = readLine()!!.toInt() var candidates = (0..9).toSet() repeat (N) { val line = readLine()!!.split(" ") val abcd = line.take(4).map(String::toInt) if (line.last() == "YES") { candidates = candidates.intersect(abcd) } else { candidates -= abcd } } println(candidates.first()) }