import java.util.*;
public class Main{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
int n = sc.nextInt();
sc.nextLine();
while(n-->0){
String str = sc.nextLine();
boolean boo = true;
for(int i=0;i<str.length();i++){
char ch = str.charAt(i);
if(ch=='_'||ch>='a'&&ch<='z'||ch>='A'&&ch<='Z'){
continue;
}
if(i>0&&ch>='0'&&ch<='9'){
continue;
}
boo = false;
break;
}
if(boo){
System.out.println("yes");
}else{
System.out.println("no");
}
}
}
}
}
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
String str = sc.next();
char cMax = str.charAt(0);
for(int i=1;i<str.length();i++){
char ch=str.charAt(i);
if(cMax<ch){
cMax = ch;
}
}
str = str.replaceAll(""+cMax, cMax+"(max)");
System.out.println(str);
}
}
}
import java.util.*;
public class Main {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
String str = sc.nextLine();
char chs[] = str.toCharArray();
boolean boo = true;
for(int i=0;i<chs.length;i++){
if(chs[i]==' '){
boo= true;
continue;
}
if(boo&&chs[i]>='a'&&chs[i]<='z'){
chs[i]=(char)(chs[i]-32);
boo=false;
}
}
str=new String(chs);
System.out.println(str);
}
}
}