#include using namespace std; int fr[1001]; int main() { int t, n, i, x; cin >> t; while(t > 0) { t--; cin >> n; memset(fr, 0, sizeof(fr)); int cnt = 0, sum = 0; for(i = 1; i <= n; i++) { cin >> x; while(x > 0) { if(fr[x % 10] == 0) cnt++; sum += x % 10; fr[x % 10]++; x /= 10; } } if(sum % 3 == 0) { cout << "Yes"; } else { cout << "No"; } cout << endl; } return 0; }