/*
    Tushar Pahuja
    Vellore Institute of Technology Chennai
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> //Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
using namespace __gnu_pbds;

#define gc getchar_unlocked

#define ll long long
#define ull unsigned long long
#define ld long double

typedef pair<int, int>	pi;
typedef pair<ll, ll>	pll;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pi>		vpi;
typedef vector<pll>		vpll;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
typedef
tree<
  pair<ll,ll>,
  null_type,
  greater<pair<ll,ll> >,
  rb_tree_tag,
  tree_order_statistics_node_update>
main_ds;

#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define sub(a,b) a-b
#define orr(a,b) a||b
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define slen(s) strlen(s)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define boostIO ios_base::sync_with_stdio(false), cin.tie(0)
#define tc(t) ll t; cin >> t; while(t--)
#define PI 3.1415926535897932384626
#define beg int main()
#define ret return 0
#define bye exit(0)
#define nxl <<endl
#define show cout<<
#define INF 0x3f3f3f3f
#define MAX 200000
#define mod 1000000007

ll power2(ll a, ll b) { if(b == 0) return 1; if(b == 1) return a; ll x = power2(a, b / 2); x = x * x; if(b % 2) x = x * a; return x;}
ll gcd(ll a, ll b) {if(a < b) swap(a, b); while(b) {ll t = b; b = a % b; a = t;} return a;}
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}
int readline( char * str ) {int i = 0;char ch;while ( (ch = getchar() ) != '\n' ) {str[i++] = ch;}str[i] = '\0';return i;}


// ll bin_ser(ll low,ll high,ll key){

//    while(low<=high){
//        ll mid = (low+high)/2;
//        if(v1[mid]<key){
//            low = mid+1;
//        }
//        else if(v1[mid]>key){
//            high = mid-1;
//        }
//        else{
//            return (mid+1);
//        }
//    }
//    return -1;
// }


//bool dfs(const vector<vector<int>>& a, vector<char>& used, int v) {
//    used[v] = 1;
//    for (int x : a[v]) {
//        if (used[x] == 1) {
//            return false;
//        } else if (used[x] == 0) {
//            if (!dfs(a, used, x)) {
//                return false;
//            }
//        }
//    }
//    used[v] = 2;
//    return true;
//}
//
//bool ensure_absence_of_cycles(const vector<vector<int>>& a) {
//    int n = a.size();
//    vector<char> used(n);
//    for (int i = 0; i < n; ++i) {
//        if (!used[i]) {
//            if (!dfs(a, used, i)) {
//                return false;
//            }
//        }
//    }
//    return true;
//}
//
//

bool yoyo(const ll p1 ,const ll p2){
    return p1 > p2;
}

beg{
ll t,a,b,c,d,x,y,z,n,m,k,i,j,l;
string s1,s2;
vl v1,v2,v3;

cin >> t;
while(t--){
    cin >> n;
    ll su=0;
    fo(i,n){
        cin >> a;
        while(a){
            su += (a%10);
            a /=10;
        }
    }
    if(su%3==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


ret;
}