#include<stdio.h>
int main() {
long long int t,num,temp,count1,count0,b;
scanf("%lld",&t);
while(t–)
{
scanf("%lld",&num);
temp=0,b=0;
temp=num;
count1=0,count0=0;
while(temp!=0)
{
b=temp%10;
if(b==1)
count1++;
else if(b==0)
count0++;
temp/=10;
}
if(num==1||num==0)
printf(“Yes\n”);
else
{
if((count1>1&&count0>1)||count1==0||count0==0)
printf(“No\n”);
else if(count1==1&&count0>1)
printf(“Yes\n”);
else if(count0==1&&count1>1)
printf(“Yes\n”);
else if(count1==1&&count0==1)
printf(“Yes\n”);
}
}return 0;
}