#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vectorvl; typedef vectorvi; typedef vectorvb; typedef vectorvd; typedef vectorvc; typedef vectorvs; #define MP make_pair #define all(v) v.begin(),v.end() const ll mod = 1000000007; const ll OO = (ll)1e18; const int dx[] = { 0, 1, -1, 0 }; const int dy[] = { 1, 0, 0, -1 }; ll gcd(ll a, ll b){ if (b == 0){ return a; }return gcd(b, a % b); } ll fast_power(ll base, ll power){ if (power == 1) return base; if (power % 2 == 0) return fast_power((base*base), power / 2); else return(base*fast_power((base*base), power / 2)); } //#pragma warning (disable : 4996) void Qalbaz() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } int solve(ll x) { int ans = 0; while (x) { ans += x % 10; x /= 10; } return ans; } int main(){ //Qalbaz(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int m; int t; cin >> t; int n; ll ans, x; while (t--) { ans = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> x; ans += solve(x); } if (ans % 3 == 0) cout << "Yes\n"; else cout << "No\n"; } return 0; }