#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pl;
template<class T> using vec = vector<T>;

#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define prt(x) cout << x << endl
#define var(x) ll x; cin >> x
#define SC(a, b) static_cast<a>(b)
#define elif else if
#define rep(i, a, b) for(ll i = (a); i < (b); i++)
#define rrep(i, a, b) for(ll i = (a); i > (b); i--)
#define fill(arr, n) for(ll i = 0;i < n;i++) cin >> arr[i]

#define X first
#define Y second
#define PB push_back
#define MP make_pair

const ll mod = SC(ll, 1e9 + 7);
const long double pi = 3.1415926535897932384626433832795;
const ll inf = SC(ll, 1e18 + 1);
const ll ninf = -1*inf;
const double eps = 1e-9;

#define TC

void solve(){}

int calc(int n){
    int ret = 0;
    while(n > 0){
        ret += n%10;
        n /= 10;
    }
    return ret;
}

void input(){
    int n; cin >> n;
    int sum = 0;
    while(n--){
        int temp; cin >> temp;
        sum += calc(temp);
    }
    if(sum%3 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

void preprocess(){}

int main(){
    preprocess();
#ifdef TC
    ll t; cin >> t; while(t--){ input(); solve(); }
#else
    input();
    solve();
#endif
    return 0;
}