#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define ff first
#define ss second
#define READ freopen("input.txt","r",stdin);
#define WRITE    freopen("output.txt","w",stdout);
#define fill(a,x) memset(a,x,sizeof(a));
#define loop(i,x,n) for(int i=x;i<n;i++)
#define TC() ll ttwea;cin>>ttwea;while(ttwea--)
#define ll long long
#define mod 1000000007
#define vi vector<ll>
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define ull unsigned long long
#define N 8000010
#define inf 10000000000000000
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
//ll dx[]={1,0,-1,0};ll dy[]={0,1,0,-1}; //4 Direction
//ll dx[]={1,1,0,-1,-1,-1,0,1};ll dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
ll gcd(ll x,ll y)
{
    if(y==0)
        return x;
    else
        return gcd(y,x%y);
}
ll expo(ll n,ll m,ll p)   //MODULAR EXPONENTIATION
{
    ll r=1;
    n=n%p;
    while(m>0)
    {
        if(m%2)
            r=(r*n)%p;
        n=(n*n)%p;
        m=m/2;
    }
    return r%p;
}
int32_t main()
{
 
   IOS;
   /*#ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin); 
   freopen("output.txt","w",stdout);
   #endif
   /********************* Code starts here ************************/
   TC()
   {
   	ll n;
   	cin>>n;
   	vi a(n);
   	int s=0;
   	for(int i=0;i<n;i++)
   	{
   		cin>>a[i];
   		while(a[i])
   		{
   			s=s+a[i]%10;
   			a[i]=a[i]/10;
   		}
   	}
   	if(s%3)
   		cout<<"No"<<endl;
   	else
   		cout<<"Yes"<<endl;
   }
}