#include <bits/stdc++.h>
using namespace std;
int get(int x){
    int ret = 0;
    while(x){
        ret += x % 10;
        x /= 10;
    }
    return ret;
}
int main(){
    int t;
    scanf("%d", &t);
    while(t--){
        int n;
        scanf("%d", &n);
        int sm = 0;
        while(n--){
            int x;
            scanf("%d", &x);
            sm += get(x);
        }
        puts(sm % 3 ? "No" : "Yes");
    }
    return 0;
}