/*input 3 1 9 3 40 50 90 2 1 4 */ #include using namespace std; int main () { int t; cin >> t; while (t--) { int n; cin >> n; long long sum = 0; while (n--) { long long x; cin >> x; while (x > 0) { sum += x % 10; x /= 10; } } if (sum % 3 == 0) cout << "Yes\n"; else cout << "No\n"; } return 0; }