/****************************************** * AUTHOR: CHIRAG AGARWAL * * INSTITUITION: BITS PILANI, PILANI * ******************************************/ #include using namespace std; typedef long long LL; typedef long double LD; int cnt[3]; int main() { int t; scanf("%d",&t); while(t--) { int n; int sm=0; scanf("%d",&n); for(int i=1;i<=n;i++) { int a; scanf("%d",&a); while(a) { sm+=(a%10); a/=10; } } if(sm%3) { printf("No\n"); } else { printf("Yes\n"); } } return 0; }