#include
using namespace std;
void checkevenodd(int n){
int even=0,odd=0;
int rem;
int count=0;
int digit;
while(n){
digit=n%10;
rem=digit%2;
if(rem==0)
{
even=even+digit;
}
else{
odd=odd+digit;
}
n=n/10;
}
if(even%4==0 || odd%3==0)
{
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
}
int main() {
int a,n;
cin>>a;
while(a–){
cin>>n;
checkevenodd(n);
}
return 0;
}