#include #define FAST_IO ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define pb push_back #define fi first #define se second #define mp make_pair #define all(_v) _v.begin(), _v.end() #define sz(_v) (int) _v.size() #define FIND(_obj, _val) (_obj.find(_val) != _obj.end()) #define RESET(_a, _v) fill_n(_a,sizeof(_a)/sizeof(_a[0]),_v) #define REP(_i, _n) for (int _i = 0; _i < (int) _n; _i++) #define FOR(_i, _a, _b) for (int _i = (int) _a; _i <= (int) _b; _i++) #define FORD(_i, _a, _b) for (int _i = (int) _a; _i >= (int) _b; _i--) #define FORIT(_it, _obj) for (auto _it = _obj.begin(); _it != _obj.end(); _it++) // DEBUG UTIL #define DEBUG(x) cerr << "> " << #x << " = " << x << endl using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pii = pair; using pll = pair; using pdd = pair; using vi = vector; using vii = vector; using vs = vector; const int DR[] = {-1, 0, 1, 0}; const int DC[] = {0, -1, 0, 1}; const double PI = acos(-1.0); const double EPS = 1e-9; const int MOD = 1e9 + 7; const int INF = 1073741823; const ll INFLL = 4e18; const int MAX = 100; int N, arr[MAX+5]; ll sum; void read() { sum = 0; cin >> N; REP(i,N) cin >> arr[i]; } void solve() { REP(i,N) { while (arr[i] > 0) { sum += arr[i]%10; arr[i] /= 10; } } if (sum%3 == 0) cout << "Yes\n"; else cout << "No\n"; } int main() { FAST_IO; int TC = 1; cin >> TC; while (TC--) { read(); solve(); } }