#include using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int res = 0; for (int i = 0; i < n; i++) { int a; cin >> a; while (a) { (res += a % 10) %= 3; a /= 10; } } cout << (res == 0 ? "Yes" : "No") << endl; } return 0; }