#include
using namespace std;
int main() {
int n,no,x=1,a,even=0,odd=0;
cin>>n;
while(x<=n){
cin>>no;
while(no>0){
a=no%10;
if(a%2==0)
even=even+a;
else
odd=odd+a;
no=no/10;
}
int sum1=even;
int sum2=odd;
float z=sum1/4;
float z1=sum2/3;
if((z==0) || (z1==0)){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
}
x=x+1;
}
return 0;
}