#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 main() {
  int t, i, j, rank[10];
  char in[10][500];
  scanf("%d", &t);
  for (j = 1; j <= t; j++) {
    int max = 0;
    for (i = 0; i < 10; i++) {
      scanf("%s%d", in[i], &rank[i]);
      if (rank[i] > max)
        max = rank[i];
    }
    printf("Case #%d:\n", j);
    for (i = 0; i < 10; i++) {
      if (rank[i] == max)
        printf("%s\n", in[i]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x13e0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec9(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1258 <main+0x138>
movl   $0x0,-0x13d4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    11d9 <main+0xb9>
movslq -0xc(%rbp),%rax
lea    -0x13d0(%rbp),%rsi
imul   $0x1f4,%rax,%rax
add    %rax,%rsi
movslq -0xc(%rbp),%rax
lea    -0x40(%rbp),%rdx
shl    $0x2,%rax
add    %rax,%rdx
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
cmp    -0x13d4(%rbp),%eax
jle    11c6 <main+0xa6>
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
mov    %eax,-0x13d4(%rbp)
jmp    11cb <main+0xab>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1168 <main+0x48>
mov    -0x10(%rbp),%esi
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1245 <main+0x125>
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
cmp    -0x13d4(%rbp),%eax
jne    1232 <main+0x112>
movslq -0xc(%rbp),%rax
lea    -0x13d0(%rbp),%rsi
imul   $0x1f4,%rax,%rax
add    %rax,%rsi
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1237 <main+0x117>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11f1 <main+0xd1>
jmp    124a <main+0x12a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114b <main+0x2b>
xor    %eax,%eax
add    $0x13e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x13b8,%rsp
lea    0xeba(%rip),%rdi
lea    0x2c(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0x2c(%rsp)
jle    1423 <main+0x2f3>
lea    0xfd0(%rsp),%r13
lea    0x11c4(%rsp),%rbx
lea    0xe8a(%rip),%r14
lea    0x30(%rsp),%rbp
xor    %r12d,%r12d
jmp    118b <main+0x5b>
cmp    0x2c(%rsp),%r12d
jge    1423 <main+0x2f3>
add    $0x1,%r12d
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    (%rsp),%r15d
test   %r15d,%r15d
mov    $0x0,%eax
cmovs  %eax,%r15d
mov    %r14,%rdi
lea    0x224(%rsp),%rsi
lea    0x4(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %r15d,%eax
cmovg  %eax,%r15d
mov    %r14,%rdi
lea    0x418(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    %r15d,%eax
cmovg  %eax,%r15d
mov    %r14,%rdi
lea    0x60c(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    %r15d,%eax
cmovg  %eax,%r15d
mov    %r14,%rdi
lea    0x800(%rsp),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x10(%rsp),%eax
cmp    %r15d,%eax
cmovg  %eax,%r15d
mov    %r14,%rdi
lea    0x9f4(%rsp),%rsi
lea    0x14(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    %r15d,%eax
cmovg  %eax,%r15d
mov    %r14,%rdi
lea    0xbe8(%rsp),%rsi
lea    0x18(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x18(%rsp),%eax
cmp    %r15d,%eax
cmovg  %eax,%r15d
mov    %r14,%rdi
lea    0xddc(%rsp),%rsi
lea    0x1c(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x1c(%rsp),%eax
cmp    %r15d,%eax
cmovg  %eax,%r15d
mov    %r14,%rdi
mov    %r13,%rsi
lea    0x20(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x20(%rsp),%eax
cmp    %r15d,%eax
cmovg  %eax,%r15d
mov    %r14,%rdi
mov    %rbx,%rsi
lea    0x24(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x24(%rsp),%eax
cmp    %r15d,%eax
cmovg  %eax,%r15d
lea    0xd27(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r15d,(%rsp)
je     1350 <main+0x220>
cmp    %r15d,0x4(%rsp)
je     135f <main+0x22f>
cmp    %r15d,0x8(%rsp)
je     1373 <main+0x243>
cmp    %r15d,0xc(%rsp)
je     138b <main+0x25b>
cmp    %r15d,0x10(%rsp)
je     13a3 <main+0x273>
cmp    %r15d,0x14(%rsp)
je     13bb <main+0x28b>
cmp    %r15d,0x18(%rsp)
je     13d3 <main+0x2a3>
cmp    %r15d,0x1c(%rsp)
je     13eb <main+0x2bb>
cmp    %r15d,0x20(%rsp)
je     1403 <main+0x2d3>
cmp    %r15d,0x24(%rsp)
jne    1180 <main+0x50>
jmp    1416 <main+0x2e6>
xchg   %ax,%ax
mov    %rbp,%rdi
call   1030 <puts@plt>
cmp    %r15d,0x4(%rsp)
jne    12f5 <main+0x1c5>
lea    0x224(%rsp),%rdi
call   1030 <puts@plt>
cmp    %r15d,0x8(%rsp)
jne    12fc <main+0x1cc>
lea    0x418(%rsp),%rdi
call   1030 <puts@plt>
cmp    %r15d,0xc(%rsp)
jne    1307 <main+0x1d7>
lea    0x60c(%rsp),%rdi
call   1030 <puts@plt>
cmp    %r15d,0x10(%rsp)
jne    1312 <main+0x1e2>
lea    0x800(%rsp),%rdi
call   1030 <puts@plt>
cmp    %r15d,0x14(%rsp)
jne    131d <main+0x1ed>
lea    0x9f4(%rsp),%rdi
call   1030 <puts@plt>
cmp    %r15d,0x18(%rsp)
jne    1328 <main+0x1f8>
lea    0xbe8(%rsp),%rdi
call   1030 <puts@plt>
cmp    %r15d,0x1c(%rsp)
jne    1333 <main+0x203>
lea    0xddc(%rsp),%rdi
call   1030 <puts@plt>
cmp    %r15d,0x20(%rsp)
jne    133e <main+0x20e>
mov    %r13,%rdi
call   1030 <puts@plt>
cmp    %r15d,0x24(%rsp)
jne    1180 <main+0x50>
mov    %rbx,%rdi
call   1030 <puts@plt>
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x13b8,%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 = [5 x i8] c"%s%d\00"
@.str.2 = [11 x i8] c"Case #%d:\0A\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [10 x i32]
%6 = alloca [10 x [500 x i8]]
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 1, i32* %4
br label %9
9: ; preds = %65, %0
%10 = load i32, i32* %4
%11 = load i32, i32* %2
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %68
13: ; preds = %9
store i32 0, i32* %7
store i32 0, i32* %3
br label %14
14: ; preds = %38, %13
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 10
br i1 %16, label %17, label %41
17: ; preds = %14
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [10 x [500 x i8]], [10 x [500 x i8]]* %6, i64 0, i64 %19
%21 = getelementptr inbounds [500 x i8], [500 x i8]* %20, i64 0, i64 0
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %23
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %21, i32* %24)
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = load i32, i32* %7
%31 = icmp sgt i32 %29, %30
br i1 %31, label %32, label %37
32: ; preds = %17
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %34
%36 = load i32, i32* %35
store i32 %36, i32* %7
br label %37
37: ; preds = %32, %17
br label %38
38: ; preds = %37
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %14
41: ; preds = %14
%42 = load i32, i32* %4
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %42)
store i32 0, i32* %3
br label %44
44: ; preds = %61, %41
%45 = load i32, i32* %3
%46 = icmp slt i32 %45, 10
br i1 %46, label %47, label %64
47: ; preds = %44
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = load i32, i32* %7
%53 = icmp eq i32 %51, %52
br i1 %53, label %54, label %60
54: ; preds = %47
%55 = load i32, i32* %3
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [10 x [500 x i8]], [10 x [500 x i8]]* %6, i64 0, i64 %56
%58 = getelementptr inbounds [500 x i8], [500 x i8]* %57, i64 0, i64 0
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %58)
br label %60
60: ; preds = %54, %47
br label %61
61: ; preds = %60
%62 = load i32, i32* %3
%63 = add nsw i32 %62, 1
store i32 %63, i32* %3
br label %44
64: ; preds = %44
br label %65
65: ; preds = %64
%66 = load i32, i32* %4
%67 = add nsw i32 %66, 1
store i32 %67, i32* %4
br label %9
68: ; preds = %9
ret i32 0
}

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