#include <iostream>

using namespace std;

int main() {
    ios::sync_with_stdio(false);

    int t;
    cin >> t;
    
    while (t--) {
        int n;
        cin >> n;

        int ans = 0;
        while (n--) {
            int tmp;
            cin >> tmp;
            ans += tmp % 3;
        }

        if (ans % 3 == 0)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}