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

typedef vector<int> vi;

int main() 
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int t,n,s,x;
    cin >> t;
    while(t--)
    {
        cin >> n;
        s = 0;
        for(int i = 0; i < n; i++)
        {
            cin >> x;
            while(x > 0)
            {
                s += (x % 10);
                x /= 10;
            }
        }
        
        cout << (s % 3 == 0? "Yes" : "No") << '\n';
    }
    return 0;
}