#include using namespace std; int main() { int test; cin>>test; int s,n,t; while(test--) { s=0; cin>>n; for(int i=0;i>t; while(t>0) { s = s+ t%10; t=t/10; } } if(s%3 == 0) { cout<<"Yes\n"; } else { cout<<"No\n"; } } return 0; }