#include #define ll long long #define norm variable_also #define ld long double #define ull unsigned ll #define mp make_pair #define pb push_back #define F first #define S second #define dec variable #define left variable_too using namespace std; const int MIN = 5e3 + 2; const int MXN = 3e5 + 2; const int INF = 1e9 + 7; const ll MOD = (1LL << 32); const ll LINF = 1e18 + 15; const double EPS = 1e-9; int t, n, a[MXN]; int main(){ /*ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);*/ #ifdef Pissoir //freopen ("input.txt", "r", stdin); //freopen ("output.txt", "w", stdout); #else //freopen ("B.in", "r", stdin); //freopen ("B.out", "w", stdout); #endif cin >> t; for (int i = 1; i <= t; ++i){ cin >> n; int ans = 0; for (int j = 1; j <= n; ++j){ cin >> a[j]; int x = a[j]; while (x){ ans += x % 10; x /= 10; } } if (ans % 3 == 0) cout << "Yes\n"; else cout << "No\n"; } return 0; }