import java.io.*; import java.util.*; import java.util.Map.Entry; import static java.lang.Math.*; public class Solution extends PrintWriter { boolean solve(int[] a) { int sum = 0; for (int x : a) { while (x > 0) { sum += x % 10; x /= 10; } } return sum % 3 == 0; } public void run() { int t = nextInt(); for (int i = 0; i < t; i++) { int n = nextInt(); int[] a = nextArray(n); if (solve(a)) { println("Yes"); } else { println("No"); } } } public static boolean nextPermutation(int[] permutation) { int n = permutation.length, a = n - 2; while (0 <= a && permutation[a] >= permutation[a + 1]) { a--; } if (a == -1) { return false; } int b = n - 1; while (permutation[b] <= permutation[a]) { b--; } swap(permutation, a, b); for (int i = a + 1, j = n - 1; i < j; i++, j--) { swap(permutation, i, j); } return true; } public static void swap(int[] array, int i, int j) { if (i == j) { return; } array[i] ^= array[j]; array[j] ^= array[i]; array[i] ^= array[j]; } int[][] nextMatrix(int n, int m) { int[][] matrix = new int[n][m]; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) matrix[i][j] = nextInt(); return matrix; } String next() { while (!tokenizer.hasMoreTokens()) tokenizer = new StringTokenizer(nextLine()); return tokenizer.nextToken(); } boolean hasNext() { while (!tokenizer.hasMoreTokens()) { String line = nextLine(); if (line == null) { return false; } tokenizer = new StringTokenizer(line); } return true; } int[] nextArray(int n) { int[] array = new int[n]; for (int i = 0; i < n; i++) { array[i] = nextInt(); } return array; } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { try { return reader.readLine(); } catch (IOException err) { return null; } } public Solution(OutputStream outputStream) { super(outputStream); } static BufferedReader reader; static StringTokenizer tokenizer = new StringTokenizer(""); static Random rnd = new Random(); public static void main(String[] args) throws IOException { reader = new BufferedReader(new InputStreamReader(System.in)); Solution solution = new Solution(System.out); solution.run(); solution.close(); reader.close(); } }