/* Tushar Pahuja Vellore Institute of Technology Chennai */ #include #include // Common file #include //Including tree_order_statistics_node_update #include using namespace std; using namespace __gnu_pbds; #define gc getchar_unlocked #define ll long long #define ull unsigned long long #define ld long double typedef pair pi; typedef pair pll; typedef vector vi; typedef vector vl; typedef vector vpi; typedef vector vpll; typedef vector vvi; typedef vector vvl; typedef tree< pair, null_type, greater >, rb_tree_tag, tree_order_statistics_node_update> main_ds; #define fo(i,n) for(i=0;in;k> t; while(t--) #define PI 3.1415926535897932384626 #define beg int main() #define ret return 0 #define bye exit(0) #define nxl <= m) a -= m; if(a < 0) a += m; return a;} ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;} int readline( char * str ) {int i = 0;char ch;while ( (ch = getchar() ) != '\n' ) {str[i++] = ch;}str[i] = '\0';return i;} // ll bin_ser(ll low,ll high,ll key){ // while(low<=high){ // ll mid = (low+high)/2; // if(v1[mid]key){ // high = mid-1; // } // else{ // return (mid+1); // } // } // return -1; // } //bool dfs(const vector>& a, vector& used, int v) { // used[v] = 1; // for (int x : a[v]) { // if (used[x] == 1) { // return false; // } else if (used[x] == 0) { // if (!dfs(a, used, x)) { // return false; // } // } // } // used[v] = 2; // return true; //} // //bool ensure_absence_of_cycles(const vector>& a) { // int n = a.size(); // vector used(n); // for (int i = 0; i < n; ++i) { // if (!used[i]) { // if (!dfs(a, used, i)) { // return false; // } // } // } // return true; //} // // bool yoyo(const ll p1 ,const ll p2){ return p1 > p2; } beg{ ll t,a,b,c,d,x,y,z,n,m,k,i,j,l; string s1,s2; vl v1,v2,v3; cin >> t; while(t--){ cin >> n; ll su=0; fo(i,n){ cin >> a; while(a){ su += (a%10); a /=10; } } if(su%3==0) cout<<"Yes"<