#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 */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int i = 0, n = 0, a = 0, b = 0, c = 0, d = 0, e = 0;
  while (1) {
    i = 0;
    n = 0;
    a = 0;
    b = 0;
    c = 0;
    d = 0;
    e = 0;
    scanf("%d", &n);
    if (n == 0)
      break;
    for (i; i < n; i++) {
      scanf("%d %d %d %d %d", &a, &b, &c, &d, &e);
      if (a <= 127 && b > 127 && c > 127 && d > 127 && e > 127)
        printf("A\n");
      else if (a > 127 && b <= 127 && c > 127 && d > 127 && e > 127)
        printf("B\n");
      else if (a > 127 && b > 127 && c <= 127 && d > 127 && e > 127)
        printf("C\n");
      else if (a > 127 && b > 127 && c > 127 && d <= 127 && e > 127)
        printf("D\n");
      else if (a > 127 && b > 127 && c > 127 && d > 127 && e <= 127)
        printf("E\n");
      else
        printf("*\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xe74(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    11b2 <main+0x92>
jmp    1367 <main+0x247>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1362 <main+0x242>
lea    0xe3b(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
lea    -0x20(%rbp),%r9
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x7f,-0x10(%rbp)
jg     1223 <main+0x103>
cmpl   $0x7f,-0x14(%rbp)
jle    1223 <main+0x103>
cmpl   $0x7f,-0x18(%rbp)
jle    1223 <main+0x103>
cmpl   $0x7f,-0x1c(%rbp)
jle    1223 <main+0x103>
cmpl   $0x7f,-0x20(%rbp)
jle    1223 <main+0x103>
lea    0xdf6(%rip),%rdi
call   1030 <printf@plt>
jmp    134f <main+0x22f>
cmpl   $0x7f,-0x10(%rbp)
jle    1266 <main+0x146>
cmpl   $0x7f,-0x14(%rbp)
jg     1266 <main+0x146>
cmpl   $0x7f,-0x18(%rbp)
jle    1266 <main+0x146>
cmpl   $0x7f,-0x1c(%rbp)
jle    1266 <main+0x146>
cmpl   $0x7f,-0x20(%rbp)
jle    1266 <main+0x146>
lea    0xdb6(%rip),%rdi
call   1030 <printf@plt>
jmp    134a <main+0x22a>
cmpl   $0x7f,-0x10(%rbp)
jle    12a9 <main+0x189>
cmpl   $0x7f,-0x14(%rbp)
jle    12a9 <main+0x189>
cmpl   $0x7f,-0x18(%rbp)
jg     12a9 <main+0x189>
cmpl   $0x7f,-0x1c(%rbp)
jle    12a9 <main+0x189>
cmpl   $0x7f,-0x20(%rbp)
jle    12a9 <main+0x189>
lea    0xd76(%rip),%rdi
call   1030 <printf@plt>
jmp    1345 <main+0x225>
cmpl   $0x7f,-0x10(%rbp)
jle    12ec <main+0x1cc>
cmpl   $0x7f,-0x14(%rbp)
jle    12ec <main+0x1cc>
cmpl   $0x7f,-0x18(%rbp)
jle    12ec <main+0x1cc>
cmpl   $0x7f,-0x1c(%rbp)
jg     12ec <main+0x1cc>
cmpl   $0x7f,-0x20(%rbp)
jle    12ec <main+0x1cc>
lea    0xd36(%rip),%rdi
call   1030 <printf@plt>
jmp    1340 <main+0x220>
cmpl   $0x7f,-0x10(%rbp)
jle    132f <main+0x20f>
cmpl   $0x7f,-0x14(%rbp)
jle    132f <main+0x20f>
cmpl   $0x7f,-0x18(%rbp)
jle    132f <main+0x20f>
cmpl   $0x7f,-0x1c(%rbp)
jle    132f <main+0x20f>
cmpl   $0x7f,-0x20(%rbp)
jg     132f <main+0x20f>
lea    0xcf6(%rip),%rdi
call   1030 <printf@plt>
jmp    133b <main+0x21b>
lea    0xce8(%rip),%rdi
call   1030 <printf@plt>
jmp    1340 <main+0x220>
jmp    1345 <main+0x225>
jmp    134a <main+0x22a>
jmp    134f <main+0x22f>
jmp    1354 <main+0x234>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b2 <main+0x92>
jmp    1160 <main+0x40>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xea8(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    (%rsp),%eax
test   %eax,%eax
je     1308 <main+0x1e8>
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%r13
lea    0x8(%rsp),%r15
lea    0x4(%rsp),%rbp
jmp    11db <main+0xbb>
nop
movl   $0x0,(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xe46(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    (%rsp),%eax
test   %eax,%eax
je     1308 <main+0x1e8>
test   %eax,%eax
jle    1190 <main+0x70>
xor    %r14d,%r14d
jmp    120f <main+0xef>
cmp    $0x7f,%eax
lea    0xe21(%rip),%rax
cmovle %rax,%rdi
test   %bl,%bl
cmove  %rax,%rdi
nopl   0x0(%rax,%rax,1)
call   1030 <puts@plt>
add    $0x1,%r14d
cmp    (%rsp),%r14d
jge    1190 <main+0x70>
lea    0xdea(%rip),%rdi
lea    0x14(%rsp),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %r15,%r8
mov    %rbp,%r9
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%ebx
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%eax
mov    0x4(%rsp),%ecx
cmp    $0x7f,%esi
jg     126a <main+0x14a>
cmp    $0x80,%ebx
jl     126a <main+0x14a>
cmp    $0x80,%edx
jl     126a <main+0x14a>
cmp    $0x80,%eax
jl     126a <main+0x14a>
lea    0xdb4(%rip),%rdi
cmp    $0x7f,%ecx
jg     1200 <main+0xe0>
cmp    $0x80,%esi
jl     1296 <main+0x176>
cmp    $0x7f,%ebx
jg     1296 <main+0x176>
cmp    $0x80,%edx
jl     1296 <main+0x176>
cmp    $0x80,%eax
jl     1296 <main+0x176>
lea    0xd8a(%rip),%rdi
cmp    $0x7f,%ecx
jg     1200 <main+0xe0>
cmp    $0x7f,%esi
setg   %sil
cmp    $0x7f,%ebx
setg   %bl
and    %sil,%bl
cmp    $0x1,%bl
jne    12c7 <main+0x1a7>
cmp    $0x7f,%edx
jg     12c7 <main+0x1a7>
cmp    $0x80,%eax
jl     12c7 <main+0x1a7>
lea    0xd57(%rip),%rdi
cmp    $0x7f,%ecx
jg     1200 <main+0xe0>
cmp    $0x7f,%edx
setg   %dl
and    %dl,%bl
cmp    $0x1,%bl
jne    12e9 <main+0x1c9>
cmp    $0x7f,%eax
jg     12e9 <main+0x1c9>
lea    0xd33(%rip),%rdi
cmp    $0x7f,%ecx
jg     1200 <main+0xe0>
lea    0xd21(%rip),%rdi
cmp    $0x80,%ecx
jl     11e4 <main+0xc4>
lea    0xd0c(%rip),%rdi
jmp    11e4 <main+0xc4>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [15 x i8] c"%d %d %d %d %d\00"
@.str.2 = [3 x i8] c"A\0A\00"
@.str.3 = [3 x i8] c"B\0A\00"
@.str.4 = [3 x i8] c"C\0A\00"
@.str.5 = [3 x i8] c"D\0A\00"
@.str.6 = [3 x i8] c"E\0A\00"
@.str.7 = [3 x i8] c"*\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %0, %116
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%10 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9
br label %117
14: ; preds = %9
%15 = load i32, i32* %2
br label %16
16: ; preds = %113, %14
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %116
20: ; preds = %16
%21 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5, i32* %6, i32* %7, i32* %8)
%22 = load i32, i32* %4
%23 = icmp sle i32 %22, 127
br i1 %23, label %24, label %38
24: ; preds = %20
%25 = load i32, i32* %5
%26 = icmp sgt i32 %25, 127
br i1 %26, label %27, label %38
27: ; preds = %24
%28 = load i32, i32* %6
%29 = icmp sgt i32 %28, 127
br i1 %29, label %30, label %38
30: ; preds = %27
%31 = load i32, i32* %7
%32 = icmp sgt i32 %31, 127
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = load i32, i32* %8
%35 = icmp sgt i32 %34, 127
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %112
38: ; preds = %33, %30, %27, %24, %20
%39 = load i32, i32* %4
%40 = icmp sgt i32 %39, 127
br i1 %40, label %41, label %55
41: ; preds = %38
%42 = load i32, i32* %5
%43 = icmp sle i32 %42, 127
br i1 %43, label %44, label %55
44: ; preds = %41
%45 = load i32, i32* %6
%46 = icmp sgt i32 %45, 127
br i1 %46, label %47, label %55
47: ; preds = %44
%48 = load i32, i32* %7
%49 = icmp sgt i32 %48, 127
br i1 %49, label %50, label %55
50: ; preds = %47
%51 = load i32, i32* %8
%52 = icmp sgt i32 %51, 127
br i1 %52, label %53, label %55
53: ; preds = %50
%54 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %111
55: ; preds = %50, %47, %44, %41, %38
%56 = load i32, i32* %4
%57 = icmp sgt i32 %56, 127
br i1 %57, label %58, label %72
58: ; preds = %55
%59 = load i32, i32* %5
%60 = icmp sgt i32 %59, 127
br i1 %60, label %61, label %72
61: ; preds = %58
%62 = load i32, i32* %6
%63 = icmp sle i32 %62, 127
br i1 %63, label %64, label %72
64: ; preds = %61
%65 = load i32, i32* %7
%66 = icmp sgt i32 %65, 127
br i1 %66, label %67, label %72
67: ; preds = %64
%68 = load i32, i32* %8
%69 = icmp sgt i32 %68, 127
br i1 %69, label %70, label %72
70: ; preds = %67
%71 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %110
72: ; preds = %67, %64, %61, %58, %55
%73 = load i32, i32* %4
%74 = icmp sgt i32 %73, 127
br i1 %74, label %75, label %89
75: ; preds = %72
%76 = load i32, i32* %5
%77 = icmp sgt i32 %76, 127
br i1 %77, label %78, label %89
78: ; preds = %75
%79 = load i32, i32* %6
%80 = icmp sgt i32 %79, 127
br i1 %80, label %81, label %89
81: ; preds = %78
%82 = load i32, i32* %7
%83 = icmp sle i32 %82, 127
br i1 %83, label %84, label %89
84: ; preds = %81
%85 = load i32, i32* %8
%86 = icmp sgt i32 %85, 127
br i1 %86, label %87, label %89
87: ; preds = %84
%88 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %109
89: ; preds = %84, %81, %78, %75, %72
%90 = load i32, i32* %4
%91 = icmp sgt i32 %90, 127
br i1 %91, label %92, label %106
92: ; preds = %89
%93 = load i32, i32* %5
%94 = icmp sgt i32 %93, 127
br i1 %94, label %95, label %106
95: ; preds = %92
%96 = load i32, i32* %6
%97 = icmp sgt i32 %96, 127
br i1 %97, label %98, label %106
98: ; preds = %95
%99 = load i32, i32* %7
%100 = icmp sgt i32 %99, 127
br i1 %100, label %101, label %106
101: ; preds = %98
%102 = load i32, i32* %8
%103 = icmp sle i32 %102, 127
br i1 %103, label %104, label %106
104: ; preds = %101
%105 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %108
106: ; preds = %101, %98, %95, %92, %89
%107 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %108
108: ; preds = %106, %104
br label %109
109: ; preds = %108, %87
br label %110
110: ; preds = %109, %70
br label %111
111: ; preds = %110, %53
br label %112
112: ; preds = %111, %36
br label %113
113: ; preds = %112
%114 = load i32, i32* %2
%115 = add nsw i32 %114, 1
store i32 %115, i32* %2
br label %16
116: ; preds = %16
br label %9
117: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [15 x i8] c"%d %d %d %d %d\00"
@str = [2 x i8] c"*\00"
@str.8 = [2 x i8] c"E\00"
@str.9 = [2 x i8] c"D\00"
@str.10 = [2 x i8] c"C\00"
@str.11 = [2 x i8] c"B\00"
@str.12 = [2 x i8] c"A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%14 = load i32, i32* %1
%15 = icmp eq i32 %14, 0
br i1 %15, label %69, label %20
16: ; preds = %63, %20
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%17 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%18 = load i32, i32* %1
%19 = icmp eq i32 %18, 0
br i1 %19, label %69, label %20
20: ; preds = %0, %16
%21 = phi i32 [ %18, %16 ], [ %14, %0 ]
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %16
23: ; preds = %20, %63
%24 = phi i32 [ %66, %63 ], [ 0, %20 ]
%25 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5, i32* %6)
%26 = load i32, i32* %2
%27 = icmp slt i32 %26, 128
%28 = load i32, i32* %3
%29 = icmp sgt i32 %28, 127
%30 = select i1 %27, i1 %29, i1 false
%31 = load i32, i32* %4
%32 = icmp sgt i32 %31, 127
%33 = select i1 %30, i1 %32, i1 false
%34 = load i32, i32* %5
%35 = icmp sgt i32 %34, 127
%36 = select i1 %33, i1 %35, i1 false
%37 = load i32, i32* %6
%38 = icmp sgt i32 %37, 127
%39 = select i1 %36, i1 %38, i1 false
br i1 %39, label %63, label %40
40: ; preds = %23
%41 = icmp sgt i32 %26, 127
%42 = icmp slt i32 %28, 128
%43 = select i1 %41, i1 %42, i1 false
%44 = select i1 %43, i1 %32, i1 false
%45 = select i1 %44, i1 %35, i1 false
%46 = select i1 %45, i1 %38, i1 false
br i1 %46, label %63, label %47
47: ; preds = %40
%48 = select i1 %41, i1 %29, i1 false
%49 = icmp slt i32 %31, 128
%50 = select i1 %48, i1 %49, i1 false
%51 = select i1 %50, i1 %35, i1 false
%52 = select i1 %51, i1 %38, i1 false
br i1 %52, label %63, label %53
53: ; preds = %47
%54 = select i1 %48, i1 %32, i1 false
%55 = icmp slt i32 %34, 128
%56 = select i1 %54, i1 %55, i1 false
%57 = select i1 %56, i1 %38, i1 false
br i1 %57, label %63, label %58
58: ; preds = %53
%59 = select i1 %54, i1 %35, i1 false
%60 = icmp slt i32 %37, 128
%61 = select i1 %59, i1 %60, i1 false
%62 = select i1 %61, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0)
br label %63
63: ; preds = %58, %53, %47, %40, %23
%64 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.12, i64 0, i64 0), %23 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.11, i64 0, i64 0), %40 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0), %47 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0), %53 ], [ %62, %58 ]
%65 = call i32 @puts(i8* dereferenceable(1) %64)
%66 = add nuw nsw i32 %24, 1
%67 = load i32, i32* %1
%68 = icmp slt i32 %66, %67
br i1 %68, label %23, label %16
69: ; preds = %16, %0
ret i32 0
}