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

typedef long long ll;
#define mp make_pair
#define pub push_back
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define db double

int a[111];

int calc(int x){
	int ans = 0;
	while(x){
		ans += x % 10;
		x /= 10;
	}
	return ans;
}

int main(){
    //freopen("input.txt", "r", stdin);
    //freopen("output2.txt", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0);
    int tt;
    cin >> tt;
    while(tt--){
    	int n;
    	cin >> n;
    	for (int i = 0; i < n; i++) cin >> a[i];
    	int sum = 0;
    	for (int i = 0; i < n; i++) sum += calc(a[i]);
    	if (sum % 3 == 0) cout << "Yes\n";
    	else cout << "No\n";
    }
}