#include using namespace std; typedef long long Int; int main() { #ifdef DEBUG freopen("in.txt","r",stdin); #endif int t; cin >> t; while(t--) { int n; cin >> n; Int sum = 0; while(n--) { Int x; cin >> x; while(x) { sum += x%10; x /= 10; } } if(sum % 3 == 0) cout << "Yes\n"; else cout << "No\n"; } return 0; }