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

int main() {
    int nTest; cin >> nTest;
    while (nTest--) {
        int s = 0;
        int n; cin >> n;
        for (int i=1; i<=n; ++i) {
            int x; cin >> x;
            while (x>0) {
                s += x%10;
                x /= 10;
            }
        }
        if (s%3==0) cout << "Yes\n";
        else cout << "No\n";
    }
}