#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int ll;

int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    ll t;cin>>t;
    while(t--){
        ll n;cin>>n;ll i;
        ll sum=0;
        ll a;
        for(i=0;i<n;i++){
            cin>>a;
            while(a){
                sum+=a%10;
                a=a/10;
            }
        }
        if(sum%3==0)cout<<"Yes\n";
        else cout<<"No\n";
    }
    return 0;
}