#include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int t; cin>>t; while(t--) { int n; cin>>n; long long int a; long long int temp=0; for(int i=0;i>a; while(a) { temp+=a%10; a/=10; } } if(temp%3==0) cout<<"Yes"<