/*Template by hemnath_d(Enlightened by chamow)*/ #include using namespace std; /*--------------------------------------------------------------*/ typedef long long ll; typedef long double ld; typedef vector vec; typedef vector vi; typedef pair pll; typedef pair pii; /*--------------------------------------------------------------*/ #define fastread ios_base::sync_with_stdio(false); cin.tie(NULL); #define pb push_back #define mp make_pair #define fx first #define sx second #define For(i,a,b) for((i)=(a);(i)<(b);++(i)) #define forw(i,a,b) for((i)=(a);(i)<=(b);++(i) #define rev(i,a,n) for(ll i=a;i>=n;i--) #define Rev(i,a,n) for(ll i=a;i>n;i--) #define inf 100000000000000 #define minf -100000000000000 /*--------------------------------------------------------------*/ //Function to add an edge for graph //Undirected graph void add_edge(vec adj[],ll a,ll b) { adj[a].pb(b); adj[b].pb(a); } /*---------------------------------------------------------------*/ //Comparator class for min-heap using priority_queue //Change the parameters before use class myComparator { public: int operator() (/*Datatype*/int p1,/*Datatype*/int p2) { return p1/*value*/ > p2/*value*/; } }; /*----------------------------------------------------------------*/ //END OF TEMPLATE /*----------------------------------------------------------------*/ int main() { fastread; ll t; cin>>t; while(t--) { ll n; cin>>n; vec arr(n); ll i,sum=0; For(i,0,n) {cin>>arr[i];sum+=arr[i]%3;} if(sum%3==0) cout<<"Yes"<