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


int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    int tc;
    cin >> tc;
    while(tc--){
        int n;
        cin >> n;
        int tot = 0;
        while(n--){
            int x;
            cin >> x;
            while(x > 0){
                tot += x % 10;
                x /= 10;
            }
        }
        if(tot % 3) puts("No");
        else puts("Yes");
    }
    
    
    return 0;
}