#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define pp pair<ll,ll>
#define MP(a,b) make_pair(a,b)
#define F first
#define S second
#define faster ios_base::sync_with_stdio(0);cin.tie(0)
#define M 1000000007

int main()
{
    faster;
    ll t,i,n,m,k,x,a,b,c;
    cin>>t;
    //t=1;
    while(t--)
    {
        cin>>n;
        ll s=0;
        vector<ll> v(n+1,0);
        for(i=1;i<=n;i++)
        {
            cin>>v[i];
            s+=v[i];
        }
        if(s%3==0) cout<<"Yes\n";
        else cout<<"No\n";
    }
    return 0;
}