#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int checkLetter(char);
int checkNubmer(char);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *, char *, char *);
int strlen(char *);
int main() {
  FILE *in, *out;
  in = fopen("input.txt", "r");
  int N;
  char str[301];
  int isLetter[6] = {1, 0, 0, 0, 1, 1};
  fscanf(in, "%d", &N);
  out = fopen("output.txt", "w");
  char c;
  fscanf(in, "%c", &c);
  int i = 0;
  while (i < N) {
    fscanf(in, "%s", str);
    int flag = 0;
    if (strlen(str) == 6) {
      flag = 1;
      int j = 0;
      for (j = 0; j < 6; j++) {
        int f = 0;
        if (isLetter[j]) {
          f = checkLetter(str[j]);
        } else {
          f = checkNubmer(str[j]);
        }
        flag &= f;
      }
    }
    printf("<%s>%s\n", str, (flag) ? "yes" : "no");
    fprintf(out, "%s\n", (flag) ? "Yes" : "No");
    i++;
  }
  fclose(in);
  fclose(out);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe67(%rip),%rdi
lea    0xe6a(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    0xe90(%rip),%rax
mov    %rax,-0x170(%rbp)
mov    0xe8a(%rip),%rax
mov    %rax,-0x168(%rbp)
mov    0xe84(%rip),%rax
mov    %rax,-0x160(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe2e(%rip),%rsi
lea    -0x1c(%rbp),%rdx
mov    $0x0,%al
call   1060 <fscanf@plt>
lea    0xe1f(%rip),%rdi
lea    0xe23(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe11(%rip),%rsi
lea    -0x171(%rbp),%rdx
mov    $0x0,%al
call   1060 <fscanf@plt>
movl   $0x0,-0x178(%rbp)
mov    -0x178(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1385 <main+0x205>
mov    -0x10(%rbp),%rdi
lea    -0x150(%rbp),%rdx
lea    0xddb(%rip),%rsi
mov    $0x0,%al
call   1060 <fscanf@plt>
movl   $0x0,-0x17c(%rbp)
lea    -0x150(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x6,%eax
jne    1318 <main+0x198>
movl   $0x1,-0x17c(%rbp)
movl   $0x0,-0x180(%rbp)
movl   $0x0,-0x180(%rbp)
cmpl   $0x6,-0x180(%rbp)
jge    1313 <main+0x193>
movl   $0x0,-0x184(%rbp)
movslq -0x180(%rbp),%rax
cmpl   $0x0,-0x170(%rbp,%rax,4)
je     12d3 <main+0x153>
movslq -0x180(%rbp),%rax
movsbl -0x150(%rbp,%rax,1),%edi
ff
call   10a0 <checkLetter@plt>
mov    %eax,-0x184(%rbp)
jmp    12ed <main+0x16d>
movslq -0x180(%rbp),%rax
movsbl -0x150(%rbp,%rax,1),%edi
ff
call   1080 <checkNubmer@plt>
mov    %eax,-0x184(%rbp)
mov    -0x184(%rbp),%eax
and    -0x17c(%rbp),%eax
mov    %eax,-0x17c(%rbp)
mov    -0x180(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x180(%rbp)
jmp    1288 <main+0x108>
jmp    1318 <main+0x198>
lea    -0x150(%rbp),%rsi
mov    -0x17c(%rbp),%ecx
lea    0xd02(%rip),%rdx
lea    0xcf7(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xce1(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x17c(%rbp),%ecx
lea    0xcde(%rip),%rdx
lea    0xcd3(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xcba(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x178(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x178(%rbp)
jmp    1223 <main+0xa3>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x158,%rsp
lea    0xe68(%rip),%rdi
lea    0xe6b(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
lea    0xe5e(%rip),%rsi
xor    %r12d,%r12d
lea    0xc(%rsp),%rdx
mov    %rax,%rdi
xor    %eax,%eax
call   1060 <fscanf@plt>
lea    0xe48(%rip),%rdi
lea    0xe4c(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,0x10(%rsp)
lea    0xe3d(%rip),%rsi
lea    0xb(%rsp),%rdx
mov    %rbx,%r14
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <fscanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    12f5 <main+0x175>
lea    0xe1c(%rip),%rbp
lea    0x20(%rsp),%r13
mov    %r14,0x18(%rsp)
jmp    1269 <main+0xe9>
nop
test   %r15d,%r15d
lea    0xe10(%rip),%rdx
lea    0xe0d(%rip),%rax
cmove  %rax,%rdx
lea    0xe05(%rip),%rbx
lea    0xe02(%rip),%rax
cmove  %rax,%rbx
lea    0xde4(%rip),%rdi
mov    %r13,%rsi
call   1050 <printf@plt>
mov    0x10(%rsp),%rdi
lea    0xdd4(%rip),%rsi
mov    %rbx,%rdx
call   1070 <fprintf@plt>
add    $0x1,%r12d
cmp    0xc(%rsp),%r12d
jge    12f5 <main+0x175>
xor    %r15d,%r15d
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1060 <fscanf@plt>
mov    %r13,%rdi
call   1040 <strlen@plt>
cmp    $0x6,%eax
jne    1210 <main+0x90>
movsbl 0x20(%rsp),%edi
call   10a0 <checkLetter@plt>
mov    %rbp,%r15
mov    %eax,%ebp
movsbl 0x21(%rsp),%edi
call   1080 <checkNubmer@plt>
mov    %eax,%ebx
and    %ebp,%ebx
movsbl 0x22(%rsp),%edi
call   1080 <checkNubmer@plt>
mov    %eax,%ebp
movsbl 0x23(%rsp),%edi
call   1080 <checkNubmer@plt>
mov    %eax,%r14d
and    %ebp,%r14d
mov    %r15,%rbp
and    %ebx,%r14d
movsbl 0x24(%rsp),%edi
call   10a0 <checkLetter@plt>
mov    %eax,%ebx
movsbl 0x25(%rsp),%edi
call   10a0 <checkLetter@plt>
mov    %eax,%r15d
and    %ebx,%r15d
and    %r14d,%r15d
mov    0x18(%rsp),%r14
and    $0x1,%r15d
jmp    1210 <main+0x90>
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    0x10(%rsp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x158,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"r\00"
@__const.main.isLetter = [6 x i32] [i32 1, i32 0, i32 0, i32 0, i32 1, i32 1]
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [11 x i8] c"output.txt\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [3 x i8] c"%s\00"
@.str.7 = [8 x i8] c"<%s>%s\0A\00"
@.str.8 = [4 x i8] c"yes\00"
@.str.9 = [3 x i8] c"no\00"
@.str.10 = [4 x i8] c"%s\0A\00"
@.str.11 = [4 x i8] c"Yes\00"
@.str.12 = [3 x i8] c"No\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca [301 x i8]
%6 = alloca [6 x i32]
%7 = alloca i8
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
%12 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %2
%13 = bitcast [6 x i32]* %6 to i8*
%14 = load i32*, i32** %2
%15 = call i32 (i32*, i8*, ...) @fscanf(i32* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%16 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %16, i32** %3
%17 = load i32*, i32** %2
%18 = call i32 (i32*, i8*, ...) @fscanf(i32* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %7)
store i32 0, i32* %8
br label %19
19: ; preds = %60, %0
%20 = load i32, i32* %8
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %75
23: ; preds = %19
%24 = load i32*, i32** %2
%25 = getelementptr inbounds [301 x i8], [301 x i8]* %5, i64 0, i64 0
%26 = call i32 (i32*, i8*, ...) @fscanf(i32* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %25)
store i32 0, i32* %9
%27 = getelementptr inbounds [301 x i8], [301 x i8]* %5, i64 0, i64 0
%28 = call i32 @strlen(i8* %27)
%29 = icmp eq i32 %28, 6
br i1 %29, label %30, label %60
30: ; preds = %23
store i32 1, i32* %9
store i32 0, i32* %10
store i32 0, i32* %10
br label %31
31: ; preds = %56, %30
%32 = load i32, i32* %10
%33 = icmp slt i32 %32, 6
br i1 %33, label %34, label %59
34: ; preds = %31
store i32 0, i32* %11
%35 = load i32, i32* %10
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %46
40: ; preds = %34
%41 = load i32, i32* %10
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [301 x i8], [301 x i8]* %5, i64 0, i64 %42
%44 = load i8, i8* %43
%45 = call i32 @checkLetter(i8 signext %44)
store i32 %45, i32* %11
br label %52
46: ; preds = %34
%47 = load i32, i32* %10
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [301 x i8], [301 x i8]* %5, i64 0, i64 %48
%50 = load i8, i8* %49
%51 = call i32 @checkNubmer(i8 signext %50)
store i32 %51, i32* %11
br label %52
52: ; preds = %46, %40
%53 = load i32, i32* %11
%54 = load i32, i32* %9
%55 = and i32 %54, %53
store i32 %55, i32* %9
br label %56
56: ; preds = %52
%57 = load i32, i32* %10
%58 = add nsw i32 %57, 1
store i32 %58, i32* %10
br label %31
59: ; preds = %31
br label %60
60: ; preds = %59, %23
%61 = getelementptr inbounds [301 x i8], [301 x i8]* %5, i64 0, i64 0
%62 = load i32, i32* %9
%63 = icmp ne i32 %62, 0
%64 = zext i1 %63 to i64
%65 = select i1 %63, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0)
%66 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* %61, i8* %65)
%67 = load i32*, i32** %3
%68 = load i32, i32* %9
%69 = icmp ne i32 %68, 0
%70 = zext i1 %69 to i64
%71 = select i1 %69, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0)
%72 = call i32 @fprintf(i32* %67, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* %71)
%73 = load i32, i32* %8
%74 = add nsw i32 %73, 1
store i32 %74, i32* %8
br label %19
75: ; preds = %19
%76 = load i32*, i32** %2
%77 = call i32 @fclose(i32* %76)
%78 = load i32*, i32** %3
%79 = call i32 @fclose(i32* %78)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [11 x i8] c"output.txt\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [3 x i8] c"%s\00"
@.str.7 = [8 x i8] c"<%s>%s\0A\00"
@.str.8 = [4 x i8] c"yes\00"
@.str.9 = [3 x i8] c"no\00"
@.str.10 = [4 x i8] c"%s\0A\00"
@.str.11 = [4 x i8] c"Yes\00"
@.str.12 = [3 x i8] c"No\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [301 x i8]
%3 = alloca i8
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = bitcast i32* %1 to i8*
%6 = getelementptr inbounds [301 x i8], [301 x i8]* %2, i64 0, i64 0
%7 = call i32 (i32*, i8*, ...) @fscanf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%8 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 (i32*, i8*, ...) @fscanf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %3)
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %52
12: ; preds = %0
%13 = getelementptr inbounds [301 x i8], [301 x i8]* %2, i64 0, i64 1
%14 = getelementptr inbounds [301 x i8], [301 x i8]* %2, i64 0, i64 2
%15 = getelementptr inbounds [301 x i8], [301 x i8]* %2, i64 0, i64 3
%16 = getelementptr inbounds [301 x i8], [301 x i8]* %2, i64 0, i64 4
%17 = getelementptr inbounds [301 x i8], [301 x i8]* %2, i64 0, i64 5
br label %18
18: ; preds = %12, %42
%19 = phi i32 [ %49, %42 ], [ 0, %12 ]
%20 = call i32 (i32*, i8*, ...) @fscanf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %6)
%21 = call i32 @strlen(i8* %6)
%22 = icmp eq i32 %21, 6
br i1 %22, label %23, label %42
23: ; preds = %18
%24 = load i8, i8* %6
%25 = call i32 @checkLetter(i8 signext %24)
%26 = and i32 %25, 1
%27 = load i8, i8* %13
%28 = call i32 @checkNubmer(i8 signext %27)
%29 = and i32 %28, %26
%30 = load i8, i8* %14
%31 = call i32 @checkNubmer(i8 signext %30)
%32 = and i32 %31, %29
%33 = load i8, i8* %15
%34 = call i32 @checkNubmer(i8 signext %33)
%35 = and i32 %34, %32
%36 = load i8, i8* %16
%37 = call i32 @checkLetter(i8 signext %36)
%38 = and i32 %37, %35
%39 = load i8, i8* %17
%40 = call i32 @checkLetter(i8 signext %39)
%41 = and i32 %40, %38
br label %42
42: ; preds = %23, %18
%43 = phi i32 [ 0, %18 ], [ %41, %23 ]
%44 = icmp eq i32 %43, 0
%45 = select i1 %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0)
%46 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* %6, i8* %45)
%47 = select i1 %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0)
%48 = call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* %47)
%49 = add nuw nsw i32 %19, 1
%50 = load i32, i32* %1
%51 = icmp slt i32 %49, %50
br i1 %51, label %18, label %52
52: ; preds = %42, %0
%53 = call i32 @fclose(i32* %4)
%54 = call i32 @fclose(i32* %8)
ret i32 0
}