#include using namespace std; int t, n, a[105]; long long s=0; int main() { int i; cin>>t; while(t--) { cin>>n; s=0; for(i=1; i<=n; i++) { cin>>a[i]; while(a[i]) { s+=(a[i]%10); a[i]/=10; } } if(s%3==0) cout<<"Yes"<<"\n"; else cout<<"No"<<"\n"; } return 0; }