#include<iostream>
#include<string.h>
#include<cctype>
using namespace std;
int main(void)
{
int n, len;
char s[50];
bool legal;
cin>>n;
getchar();
for(int i = 0; i < n; i++)
{
legal = true;
gets(s);
len = strlen(s);
if(!isalpha(s[0]) && s[0] != '_') legal = false;
else
{
for(int j = 0; j < len; j++)
{
if(!isdigit(s[j]) && !isalpha(s[j]) && s[j] != '_') legal = false;
}
}
if(legal) cout<<"yes"<<endl;
else cout<<"no"<<endl;
}
return 0;
}
#include<string.h>
#include<cctype>
using namespace std;
int main(void)
{
int n, len;
char s[50];
bool legal;
cin>>n;
getchar();
for(int i = 0; i < n; i++)
{
legal = true;
gets(s);
len = strlen(s);
if(!isalpha(s[0]) && s[0] != '_') legal = false;
else
{
for(int j = 0; j < len; j++)
{
if(!isdigit(s[j]) && !isalpha(s[j]) && s[j] != '_') legal = false;
}
}
if(legal) cout<<"yes"<<endl;
else cout<<"no"<<endl;
}
return 0;
}