#include #include #include #include #include using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; ++i) { int n; cin >> n; vector a(n); for (int i = 0; i < n; ++i) cin >> a[i]; int s = 0; for (int b : a) s += b % 3; if (s % 3) { cout << "No\n"; } else { cout << "Yes\n"; } } return 0; }