import java.io.*; import java.util.StringTokenizer; public class Main { static MyScanner sc; private static PrintWriter out; static long M2 = 1_000_000_000L + 7; public static void main(String[] s) throws Exception { StringBuilder stringBuilder = new StringBuilder(); if (stringBuilder.length() == 0) { sc = new MyScanner(System.in); } else { sc = new MyScanner(new BufferedReader(new StringReader(stringBuilder.toString()))); } out = new PrintWriter(new OutputStreamWriter(System.out)); initData(); solveT(); out.flush(); } private static void initData() { } private static void solve() throws IOException { int n = sc.nextInt(); long t = 0; while (n-->0) { t+=sc.nextInt(); } t %= 3; out.println(t == 0 ? "Yes" : "No"); } private static void solveT() throws IOException { int t = sc.nextInt(); while (t-- > 0) { solve(); } } private static long gcd(long l, long l1) { if (l > l1) return gcd(l1, l); if (l == 0) return l1; return gcd(l1 % l, l); } private static long pow(long a, long b, long m) { if (b == 0) return 1; if (b == 1) return a; long pp = pow(a, b / 2, m); pp *= pp; pp %= m; return (pp * (b % 2 == 0 ? 1 : a)) % m; } static class MyScanner { BufferedReader br; StringTokenizer st; MyScanner(BufferedReader br) { this.br = br; } public MyScanner(InputStream in) { this(new BufferedReader(new InputStreamReader(in))); } void findToken() { while (st == null || !st.hasMoreTokens()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } } String next() { findToken(); return st.nextToken(); } Integer[] nab(int n) { Integer[] k = new Integer[n]; for (int i = 0; i < n; i++) { k[i] = sc.fi(); } return k; } int[] na(int n) { int[] k = new int[n]; for (int i = 0; i < n; i++) { k[i] = sc.fi(); } return k; } long[] nl(int n) { long[] k = new long[n]; for (int i = 0; i < n; i++) { k[i] = sc.nextLong(); } return k; } int nextInt() { return Integer.parseInt(next()); } int fi() { String t = next(); int cur = 0; boolean n = t.charAt(0) == '-'; for (int a = n ? 1 : 0; a < t.length(); a++) { cur = cur * 10 + t.charAt(a) - '0'; } return n ? -cur : cur; } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } } }