#include using namespace std; #define fill(a,val) memset(a, (val), sizeof a) #define pb push_back #define lli long long int #define scantype int #define endl "\n" #define unique(x) x.erase(unique(x.begin(),x.end()), x.end()) #define sort_f(x) sort(x.begin(),x.end()); #define sort_r(x) sort(x.rbegin(),x.rend()); lli MOD = 1000000007; lli inf = 1e15; void scan(scantype &x); lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;} lli string_to_number(string s){lli x=0; stringstream convert(s); convert>>x; return x;} lli add(lli a,lli b){lli x = (a+b)%MOD; return x; } lli mul(lli a,lli b){lli x = (a*b)%MOD; return x; } lli sub(lli a,lli b){lli x = (a-b+MOD)%MOD; return x; } lli divi(lli a,lli b){lli x = a;lli y = powermod(b,MOD-2,MOD);lli res = (x*y)%MOD;return res;} #define N 200003 int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin>>t; for(int i=0;i>n; int sum=0; for(int j=0;j>str; for(int k=0;k<(int)str.length();k++) { sum+=str[k]-'0'; } } if(sum%3==0) { cout<<"Yes"<