#include using namespace std; #define pb push_back #define mp make_pair #define F first #define S second #define fo(i, n) for(int i = 1; i <= n; ++i) typedef long long ll; typedef pair pii; typedef pair pll; const int N = 200200; const int mod = 1e9 + 7; int t, n, x; int main() { cin >> t; while(t--) { int res = 0; cin >> n; fo(i, n) { cin >> x; while(x) res += x % 10, x /= 10; } if(res % 3 == 0) cout << "Yes\n"; else cout << "No\n"; } return 0; }