#include #include #include #include #include using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; long x = 0; for (int i = 0; i < n; ++i) { string y; cin >> y; for (int j = 0; j < y.length(); ++j) { x += y[j] - '0'; } } string z = to_string(x); long r = 0; for (int i = 0; i < z.length(); ++i) { r += z[i] - '0'; } if (r % 3 == 0) {cout << "Yes\n";} else {cout << "No\n";} } return 0; }