#include using namespace std; int main() { long long i,j,n; long long t; cin>>t; while(t--) { cin>>n; vector ss; string str; long long xx = 0; for(i=0;i>str; ss.push_back(str); for(j=0;str[j];j++) { xx+=(str[j]-'0'); } } if(xx%3==0) cout<<"Yes\n"; else cout<<"No\n"; } }