/* ****Enigma27**** */ #include #define ll long long #define pb push_back #define endl '\n' #define pll pair #define vll vector #define all(a) (a).begin(),(a).end() #define x first #define y second #define hell 1000000007 #define lbnd lower_bound #define ubnd upper_bound #define bs binary_search #define rep(i,a,b) for(ll i=a;ia m; ll f(ll x){ ll k=0; while(x>0){ k+=x%10; x/=10; } return k; } int main() { ios cin>>q; while(q--){ cin>>n; ans=0; for(i=0;i>k; ans+=f(k); } if(ans%3==0) cout<<"Yes\n"; else cout<<"No\n"; } return 0; }