#include #define mp make_pair #define vi vector #define xx first #define yy second #define all(a) a.begin(), a.end() #define vsort(v) sort(all(v)) #define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end()) #define clr(a,k) memset(a,k,sizeof a) #define bclr(b) memset(b,false,sizeof b) #define fr(i, a) for(i = 0; i < a; i++) #define frr(i,a) for(i = a - 1; i >= 0, i--) #define LL long long #define ll long long #define pb push_back #define pii pair #define pll pair #define vll vector ///***** bit *****/// #define check_bit(a, b) (a&(1ll< #define CLR(aa, nnn) for(int ii = 0; ii <= nnn; ii++) {aa[ii].clear();} using namespace std; #define T(a) cerr << #a << ": " << a << endl; #define TT(a,b) cerr << #a << ": " << a << " | " << #b << ": " << b << endl; #define TTT(a,b,c) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << endl; #define TTTT(a,b,c,d) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl; ///******* Template ********/// template inline T bigmod(T p,T e,T M) { if(e==0)return 1; if(e%2==0) { T t=bigmod(p,e/2,M); return (t*t)%M; } return (bigmod(p,e-1,M)*p)%M; } template inline T gcd(T a,T b) { if(b==0)return a; return gcd(b,a%b); } template inline T modinverse(T a,T M) { return bigmod(a,M-2,M); } /** return (a * b) % m; where a, b, m <= 10^18 **/ template inline T multimod(T a, T b, T m) { T ans = 0; a%=m, b%=m; while(b) { if(b&1) ans = m - ans > a?(ans + a): (ans + a - m); b >>= 1; a = (m - a)>a?a+a:a+a-m; } return (T)ans; } void sc(int &a) { scanf("%d", &a); } void sc(ll &a) { scanf("%lld", &a); } void sc(double &a) { scanf("%lf", &a); } void sc(int &a, int &b) { scanf("%d %d", &a, &b); } void sc(ll &a, ll &b) { scanf("%lld %lld", &a, &b); } void sc(int &a, int &b, int &c) { scanf("%d %d %d", &a, &b, &c); } void sc(int &a, int &b, ll &c) { scanf("%d %d %lld", &a, &b, &c); } void sc(ll &a, ll &b, ll &c) { scanf("%lld %lld %lld", &a, &b, &c); } void sc(string &str) { cin>>str; } void sc(char *(str)) { scanf(" %s", str); } void sc(char &c) { scanf(" %c", &c); } ///****** fast scan ends here ***********/// //int dr[] = {-1, 0, 1, 0}; //int dc[] = {0, 1, 0, -1}; /// 4 sides //int dr[] = {-1, -1, 0, 1, 1, 1, 0, -1}; //int dc[] = {0, 1, 1, 1, 0, -1, -1, -1}; /// 8 sides #define LEN(a) strlen(a) #define ull unsigned long long #define nl printf("\n") #define INF 10000000000000000ll #define MX (lim*4 + 10) #define lim 100000 /// 10^5 ///***** Template ends here *****/// ///********************* Code starts here **************************** void scanF(int &x) { register int c = getchar(); x = 0; for(; (c<48 || c>57); c = getchar()); for(; c>47 && c<58; c = getchar()) { x = (x<<1) + (x<<3) + c - 48; } } int arr[MAX]; int main() { int k, m; int t, i, j; int q, u, v; int n, l; string str; cin>>t; while(t--) { cin>>n; int s = 0; while(n--) { cin>>str; int l = str.length(); for(i = 0; i < l; i++) s += str[i]-'0'; } if(s%3==0) cout<<"Yes"<