#include using namespace std; #define ll long long #define sp ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL) #define mp make_pair #define cps CLOCKS_PER_SEC #define mod (ll)1000000007 #define f first #define s second #define debug1(x) cout< #define pii pair #define pb push_back #define mxn 200005 int s(int d){ int x=0; while(d){ x+=d%10; d/=10; } return x; } int main(){ sp; int t; cin>>t; while(t--){ int n,x,y=0; cin>>n; for(int i=0; i>x; y=(y+s(x))%3; } if(!y) cout<<"Yes\n"; else cout<<"No\n"; } return 0;}