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

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

int main() {
    int t; cin >> t;
    while(t--) {
        int n; cin >> n;
        int ans = 0;
        for(int i = 0; i < n; ++i) {
            int x; cin >> x;
            auto s = to_string(x);
            for(auto c : s) {
                ans += (c - '0');
            }
        }
        if(ans % 3 == 0) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}