//An Emperor Production //in Association with Assistant Professor MR Ram Kripal Mishra. //Copyright (C) 2017,2015 CodeGeeks, Inc., //647 Shivpuri Kanpur, INDIA //Everyone is permitted to copy and distribute verbatim copies //of this code, but changing it is not allowed. #include using namespace std; #define ln pf("\n") #define SSTR( x ) static_cast< std::ostringstream & >( \ ( std::ostringstream() << std::dec << x ) ).str() #define I inr() #define C inc() #define SS ins() #define sp pf(" ") #define loop(i,a,b) for(int i=a;i=b;i--) #define pb push_back #define NORM(x) if(x>=MOD)x-=MOD #define CLR(x,y) memset(x,y,sizeof(x)) #define mp make_pair #define um unordered_map #define ppb pop_back() #define pf printf #define pi pair #define sf scanf #define swi switch #define vec vector #define veci vector #define vecs vector typedef long long ll; ll MOD = 1e9; typedef unsigned long long ull; typedef string str; void ins(string &s){getline(cin,s);} int to_num(string s){return atoi(s.c_str());} ll power(ll x, ll y){ll temp;if( y == 0)return 1;temp = power(x, y/2)%MOD;if (y%2 == 0)return (temp%MOD*temp%MOD)%MOD;else{if(y > 0)return (x%MOD*temp%MOD*temp%MOD)%MOD;else return (temp*temp)/x;}} void to_binary(ll n){if(n==1){cout<<1; return;}to_binary(n>>1);cout<>V;return V;} str ins(){str s;cin>>s;return s;} char inc(){char c;cin>>c;return c;} int main() { int t=I; while(t--) { int n; cin>>n; int sum=0; loop(i,0,n) { int elem; cin>>elem; while(elem) { sum+=elem%10; elem/=10; } } if(sum%3==0) cout<<"Yes\n"; else cout<<"No\n"; } return 0; }