import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); while (t-- > 0) { int n = scan.nextInt(); int total = 0; for (int i = 0; i < n; i++) { int number = scan.nextInt(); while (number > 0) { total += number % 10; number /= 10; } } System.out.println(total % 3 == 0 ? "Yes" : "No"); } scan.close(); } }