#include<stdio.h>
#include<string.h>
int main()
{
int M,i;
char A[100];
scanf("%d",&M);
getchar();
while(M--)
{
for(i=0;i<=strlen(A);i++)
A[i]='\0';
gets(A);
int flag=0,a=0,b=0,c=0,d=0;
if(strlen(A)<8||strlen(A)>16)
{
printf("NO\n");
continue;
}
for(i=0;A[i]!='\0';i++)
{
if(A[i]>='a'&&A[i]<='z') a=1;
else if(A[i]>='A'&&A[i]<='Z') b=1;
else if(A[i]>='0'&&A[i]<='9') c=1;
else if(A[i]=='~'||A[i]=='!'||A[i]=='@'||A[i]=='#'||A[i]=='$'||A[i]=='%'||A[i]=='^') d=1;
}
flag=a+b+c+d;
if(flag>=3) printf("YES\n");
else printf("NO\n");
}
return 0;
}
01-17
08-05