#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ isalnum(char);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int strlen(char *);
int main() {
  int n;
  int flag;
  char c[1000];
  scanf("%d", &n);
  while (n--) {
    flag = 0;
    scanf("%s", c);
    if (c[0] >= '0' && c[0] <= '9') {
      flag = 1;
    }
    for (int i = 0; i < strlen(c); i++) {
      if (!(isalnum(c[i]) || c[i] == '_')) {
        flag = 1;
        break;
      }
    }
    if (flag == 1)
      printf("No\n");
    else
      printf("Yes\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1274 <main+0x134>
movl   $0x0,-0xc(%rbp)
lea    -0x400(%rbp),%rsi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
movsbl -0x400(%rbp),%eax
cmp    $0x30,%eax
jl     11bb <main+0x7b>
movsbl -0x400(%rbp),%eax
cmp    $0x39,%eax
jg     11bb <main+0x7b>
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x404(%rbp)
mov    -0x404(%rbp),%eax
mov    %eax,-0x408(%rbp)
lea    -0x400(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x408(%rbp),%eax
cmp    %ecx,%eax
jge    1248 <main+0x108>
movslq -0x404(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%edi
ff
call   1050 <isalnum@plt>
cmp    $0x0,%rax
jne    122f <main+0xef>
movslq -0x404(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%eax
ff
cmp    $0x5f,%eax
je     122f <main+0xef>
movl   $0x1,-0xc(%rbp)
jmp    1248 <main+0x108>
jmp    1234 <main+0xf4>
mov    -0x404(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x404(%rbp)
jmp    11c5 <main+0x85>
cmpl   $0x1,-0xc(%rbp)
jne    1263 <main+0x123>
lea    0xdad(%rip),%rdi
call   1040 <printf@plt>
jmp    126f <main+0x12f>
lea    0xda0(%rip),%rdi
call   1040 <printf@plt>
jmp    1164 <main+0x24>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3f8,%rsp
lea    0xea8(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
subl   $0x1,0xc(%rsp)
jae    117f <main+0x3f>
xor    %eax,%eax
add    $0x3f8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe7d(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xe78(%rip),%r15
lea    0xe6d(%rip),%r12
jmp    11bb <main+0x7b>
nopl   0x0(%rax,%rax,1)
add    $0xd0,%r13b
cmp    $0xa,%r13b
mov    %r12,%rdi
cmovb  %r15,%rdi
call   1030 <puts@plt>
subl   $0x1,0xc(%rsp)
jb     116b <main+0x2b>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x10(%rsp),%r13b
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11a0 <main+0x60>
xor    %ebp,%ebp
jmp    11f3 <main+0xb3>
nopl   (%rax)
add    $0x1,%rbp
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbp
jge    11a0 <main+0x60>
movsbl 0x10(%rsp,%rbp,1),%edi
call   1050 <isalnum@plt>
test   %rax,%rax
jne    11e0 <main+0xa0>
cmpb   $0x5f,0x10(%rsp,%rbp,1)
je     11e0 <main+0xa0>
mov    %r15,%rdi
jmp    11af <main+0x6f>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"No\0A\00"
@.str.3 = [5 x i8] c"Yes\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1000 x i8]
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %7
7: ; preds = %56, %0
%8 = load i32, i32* %2
%9 = add nsw i32 %8, -1
store i32 %9, i32* %2
%10 = icmp ne i32 %8, 0
br i1 %10, label %11, label %57
11: ; preds = %7
store i32 0, i32* %3
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp sge i32 %16, 48
br i1 %17, label %18, label %24
18: ; preds = %11
%19 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp sle i32 %21, 57
br i1 %22, label %23, label %24
23: ; preds = %18
store i32 1, i32* %3
br label %24
24: ; preds = %23, %18, %11
store i32 0, i32* %5
br label %25
25: ; preds = %46, %24
%26 = load i32, i32* %5
%27 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%28 = call i32 @strlen(i8* %27)
%29 = icmp slt i32 %26, %28
br i1 %29, label %30, label %49
30: ; preds = %25
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = call i64 @isalnum(i8 signext %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %45, label %37
37: ; preds = %30
%38 = load i32, i32* %5
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 95
br i1 %43, label %45, label %44
44: ; preds = %37
store i32 1, i32* %3
br label %49
45: ; preds = %37, %30
br label %46
46: ; preds = %45
%47 = load i32, i32* %5
%48 = add nsw i32 %47, 1
store i32 %48, i32* %5
br label %25
49: ; preds = %44, %25
%50 = load i32, i32* %3
%51 = icmp eq i32 %50, 1
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %56
54: ; preds = %49
%55 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %56
56: ; preds = %54, %52
br label %7
57: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@str = [4 x i8] c"Yes\00"
@str.4 = [3 x i8] c"No\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = add nsw i32 %6, -1
store i32 %7, i32* %1
%8 = icmp eq i32 %6, 0
br i1 %8, label %38, label %9
9: ; preds = %0, %32
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%11 = load i8, i8* %4
%12 = add i8 %11, -48
%13 = icmp ult i8 %12, 10
%14 = call i32 @strlen(i8* %4)
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %30
16: ; preds = %9, %25
%17 = phi i64 [ %26, %25 ], [ 0, %9 ]
%18 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = call i64 @isalnum(i8 signext %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %16
%23 = load i8, i8* %18
%24 = icmp eq i8 %23, 95
br i1 %24, label %25, label %32
25: ; preds = %16, %22
%26 = add nuw nsw i64 %17, 1
%27 = call i32 @strlen(i8* %4)
%28 = sext i32 %27 to i64
%29 = icmp slt i64 %26, %28
br i1 %29, label %16, label %30
30: ; preds = %25, %9
%31 = select i1 %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0)
br label %32
32: ; preds = %22, %30
%33 = phi i8* [ %31, %30 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str.4, i64 0, i64 0), %22 ]
%34 = call i32 @puts(i8* dereferenceable(1) %33)
%35 = load i32, i32* %1
%36 = add nsw i32 %35, -1
store i32 %36, i32* %1
%37 = icmp eq i32 %35, 0
br i1 %37, label %38, label %9
38: ; preds = %32, %0
ret i32 0
}