#include "bits/stdc++.h" #include #include using namespace std; typedef long long int Int; #define setbits(ff) __builtin_popcount(ff) #define fast cin.sync_with_stdio(0);cin.tie(0) long long int mod = 1e9 + 7; Int fexpo(Int a,Int b) { if(b == 0) return 1LL; if(b == 1) return a % 9; if(b == 2) return ((a % 9) * (a % 9)) % 9; if(b%2 == 0) return fexpo(fexpo(a,b/2),2); else return ((a % 9) * (fexpo(fexpo(a,(b-1)/2),2)) % 9) % 9; } long long int ar[1101010]; int alldig(int x) { int sum = 0; while(x!= 0) { int r = x % 10; sum += r; x = x/10; } return sum; } int main() { int t; cin >> t; while(t--) { int n; cin >> n; long long int sum = 0; for(int i = 0 ; i < n ;i++){ cin >> ar[i]; sum += alldig(ar[i]);} if((sum %3 == 0)) cout << "Yes" << endl; else cout << "No" << endl; } }