/** * https://www.hackerrank.com/contests/hourrank-25/challenges/constructing-a-number * @author hendrawd */ fun main(args: Array) { val testCases = readLine()!!.toInt() for (index in 0 until testCases) { readLine()!!.toInt() val arr = readLine()!!.replace("0", "").split(" ") var str = "" for (x in arr) { str += x } if (str.toInt() % 3 == 0) { println("Yes") } else { println("No") } } }