#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

typedef unsigned int ui;
typedef unsigned long long ul;
typedef long long sl;

int main(int argc, char* argv[])
{
    ios_base::sync_with_stdio(false);

    ui t;
    cin >> t;

    for (; t; --t) {
        ui n;
        cin >> n;

        ui r = 0;

        for (ui i = 0; i < n; ++i) {
            ui x;
            cin >> x;

            while (x) {
                r += x % 10;
                x /= 10;
            }
        }

        if (r % 3)
            cout << "No\n";
        else
            cout << "Yes\n";
    }
    return 0;
}