fun no() = println("NO") fun readData() { val lines = readln().toInt() var i = 0; for (i in 1..lines) { val params = readln().split(" ").sortedBy { -it.length } val n = params[0].toInt() val a = params[1].toInt() val b = params[2].toInt() val ab = params[1] + params[2] if (n != a * b) { no() // println("a") continue } if (params[1].length != params[2].length) { no() // println("b") continue } if (a % 10 != 0 && b % 10 != 0) { no() // println("c") continue } val map = mutableMapOf() ab.forEach { if (map.containsKey(it)) { map[it] = map[it]?.plus(1) ?: 0 } else { map[it] = 1 } } params[0].forEach { if (map.containsKey(it)) { if(map[it]!! > 1) { map[it] = map[it]?.minus(1) ?: 0 } else { map.remove(it) } } else { no() } } if (map.isNotEmpty()) { no() // println("d") continue } println("YES") } } fun main() { readData() } class Vampires { }