#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*/ freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main() {
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
  char webpage[10][100];
  int preference[10], maximum, i, t, j;
  scanf("%d", &t);
  for (j = 1; j <= t; j++) {
    for (i = 0; i < 3; i++)
      scanf("%s %d", webpage[i], &preference[i]);
    for (i = 0, maximum = 0; i < 3; i++) {
      if (preference[i] > maximum)
        maximum = preference[i];
    }
    printf("Case #%d:\n", j);
    for (i = 0; i < 3; i++) {
      if (preference[i] == maximum)
        printf("%s\n", webpage[i]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9f(%rip),%rax
mov    (%rax),%edx
lea    0xeae(%rip),%rdi
lea    0xeae(%rip),%rsi
call   1040 <freopen@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%edx
lea    0xe9b(%rip),%rdi
lea    0xe9c(%rip),%rsi
call   1040 <freopen@plt>
lea    0xe95(%rip),%rdi
lea    -0x42c(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x1,-0x430(%rbp)
mov    -0x430(%rbp),%eax
cmp    -0x42c(%rbp),%eax
jg     1310 <main+0x1e0>
movl   $0x0,-0x428(%rbp)
cmpl   $0x3,-0x428(%rbp)
jge    120e <main+0xde>
movslq -0x428(%rbp),%rax
lea    -0x3f0(%rbp),%rsi
imul   $0x64,%rax,%rax
add    %rax,%rsi
movslq -0x428(%rbp),%rax
lea    -0x420(%rbp),%rdx
shl    $0x2,%rax
add    %rax,%rdx
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x428(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x428(%rbp)
jmp    11b5 <main+0x85>
movl   $0x0,-0x428(%rbp)
movl   $0x0,-0x424(%rbp)
cmpl   $0x3,-0x428(%rbp)
jge    1276 <main+0x146>
movslq -0x428(%rbp),%rax
mov    -0x420(%rbp,%rax,4),%eax
cmp    -0x424(%rbp),%eax
jle    125d <main+0x12d>
movslq -0x428(%rbp),%rax
mov    -0x420(%rbp,%rax,4),%eax
mov    %eax,-0x424(%rbp)
jmp    1262 <main+0x132>
mov    -0x428(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x428(%rbp)
jmp    1222 <main+0xf2>
mov    -0x430(%rbp),%esi
lea    0xd96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x428(%rbp)
cmpl   $0x3,-0x428(%rbp)
jge    12f7 <main+0x1c7>
movslq -0x428(%rbp),%rax
mov    -0x420(%rbp,%rax,4),%eax
cmp    -0x424(%rbp),%eax
jne    12de <main+0x1ae>
movslq -0x428(%rbp),%rax
lea    -0x3f0(%rbp),%rsi
imul   $0x64,%rax,%rax
add    %rax,%rsi
lea    0xd4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e3 <main+0x1b3>
mov    -0x428(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x428(%rbp)
jmp    1294 <main+0x164>
jmp    12fc <main+0x1cc>
mov    -0x430(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x430(%rbp)
jmp    1199 <main+0x69>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
mov    0x2e90(%rip),%rax
mov    (%rax),%edx
lea    0xe9f(%rip),%rdi
lea    0xe9f(%rip),%rsi
call   1050 <freopen@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edx
lea    0xe8c(%rip),%rdi
lea    0xe8d(%rip),%rsi
call   1050 <freopen@plt>
lea    0xe86(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    129f <main+0x15f>
lea    0xa4(%rsp),%r15
lea    0x108(%rsp),%r13
lea    0xe55(%rip),%rbx
lea    0x40(%rsp),%rbp
xor    %r14d,%r14d
jmp    11db <main+0x9b>
nopl   0x0(%rax,%rax,1)
cmp    0xc(%rsp),%r14d
jge    129f <main+0x15f>
add    $0x1,%r14d
mov    %rbx,%rdi
mov    %rbp,%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
lea    0x14(%rsp),%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
lea    0x18(%rsp),%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x10(%rsp),%r12d
test   %r12d,%r12d
mov    $0x0,%eax
cmovs  %eax,%r12d
mov    0x14(%rsp),%eax
cmp    %r12d,%eax
cmovg  %eax,%r12d
mov    0x18(%rsp),%eax
cmp    %r12d,%eax
cmovg  %eax,%r12d
lea    0xdd6(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r12d,0x10(%rsp)
je     1270 <main+0x130>
cmp    %r12d,0x14(%rsp)
je     127f <main+0x13f>
cmp    %r12d,0x18(%rsp)
jne    11d0 <main+0x90>
jmp    1292 <main+0x152>
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1030 <puts@plt>
cmp    %r12d,0x14(%rsp)
jne    125b <main+0x11b>
mov    %r15,%rdi
call   1030 <puts@plt>
cmp    %r12d,0x18(%rsp)
jne    11d0 <main+0x90>
mov    %r13,%rdi
call   1030 <puts@plt>
jmp    11d0 <main+0x90>
xor    %eax,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"in.txt\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [8 x i8] c"out.txt\00"
@.str.3 = [2 x i8] c"w\00"
@stdout = global i32 0
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [6 x i8] c"%s %d\00"
@.str.6 = [11 x i8] c"Case #%d:\0A\00"
@.str.7 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x [100 x i8]]
%3 = alloca [10 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = load i32, i32* @stdin
%9 = call i32 @freopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @stdout
%11 = call i32 @freopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
store i32 1, i32* %7
br label %13
13: ; preds = %77, %0
%14 = load i32, i32* %7
%15 = load i32, i32* %6
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %80
17: ; preds = %13
store i32 0, i32* %5
br label %18
18: ; preds = %30, %17
%19 = load i32, i32* %5
%20 = icmp slt i32 %19, 3
br i1 %20, label %21, label %33
21: ; preds = %18
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [10 x [100 x i8]], [10 x [100 x i8]]* %2, i64 0, i64 %23
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %24, i64 0, i64 0
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %27
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %25, i32* %28)
br label %30
30: ; preds = %21
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %18
33: ; preds = %18
store i32 0, i32* %5
store i32 0, i32* %4
br label %34
34: ; preds = %50, %33
%35 = load i32, i32* %5
%36 = icmp slt i32 %35, 3
br i1 %36, label %37, label %53
37: ; preds = %34
%38 = load i32, i32* %5
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %39
%41 = load i32, i32* %40
%42 = load i32, i32* %4
%43 = icmp sgt i32 %41, %42
br i1 %43, label %44, label %49
44: ; preds = %37
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %46
%48 = load i32, i32* %47
store i32 %48, i32* %4
br label %49
49: ; preds = %44, %37
br label %50
50: ; preds = %49
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 1
store i32 %52, i32* %5
br label %34
53: ; preds = %34
%54 = load i32, i32* %7
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %54)
store i32 0, i32* %5
br label %56
56: ; preds = %73, %53
%57 = load i32, i32* %5
%58 = icmp slt i32 %57, 3
br i1 %58, label %59, label %76
59: ; preds = %56
%60 = load i32, i32* %5
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %61
%63 = load i32, i32* %62
%64 = load i32, i32* %4
%65 = icmp eq i32 %63, %64
br i1 %65, label %66, label %72
66: ; preds = %59
%67 = load i32, i32* %5
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [10 x [100 x i8]], [10 x [100 x i8]]* %2, i64 0, i64 %68
%70 = getelementptr inbounds [100 x i8], [100 x i8]* %69, i64 0, i64 0
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %70)
br label %72
72: ; preds = %66, %59
br label %73
73: ; preds = %72
%74 = load i32, i32* %5
%75 = add nsw i32 %74, 1
store i32 %75, i32* %5
br label %56
76: ; preds = %56
br label %77
77: ; preds = %76
%78 = load i32, i32* %7
%79 = add nsw i32 %78, 1
store i32 %79, i32* %7
br label %13
80: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"in.txt\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [8 x i8] c"out.txt\00"
@.str.3 = [2 x i8] c"w\00"
@stdout = global i32 0
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [6 x i8] c"%s %d\00"
@.str.6 = [11 x i8] c"Case #%d:\0A\00"
define i32 @main() {
%1 = alloca [10 x [100 x i8]]
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = load i32, i32* @stdin
%5 = tail call i32 @freopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = load i32, i32* @stdout
%7 = tail call i32 @freopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds [10 x [100 x i8]], [10 x [100 x i8]]* %1, i64 0, i64 0, i64 0
%9 = bitcast [10 x i32]* %2 to i8*
%10 = bitcast i32* %3 to i8*
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 1
br i1 %13, label %53, label %14
14: ; preds = %0
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%16 = getelementptr inbounds [10 x [100 x i8]], [10 x [100 x i8]]* %1, i64 0, i64 1, i64 0
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 1
%18 = getelementptr inbounds [10 x [100 x i8]], [10 x [100 x i8]]* %1, i64 0, i64 2, i64 0
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 2
br label %20
20: ; preds = %14, %49
%21 = phi i32 [ %50, %49 ], [ 1, %14 ]
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %8, i32* %15)
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %16, i32* %17)
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %18, i32* %19)
%25 = load i32, i32* %15
%26 = icmp sgt i32 %25, 0
%27 = select i1 %26, i32 %25, i32 0
%28 = load i32, i32* %17
%29 = icmp sgt i32 %28, %27
%30 = select i1 %29, i32 %28, i32 %27
%31 = load i32, i32* %19
%32 = icmp sgt i32 %31, %30
%33 = select i1 %32, i32 %31, i32 %30
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %21)
%35 = load i32, i32* %15
%36 = icmp eq i32 %35, %33
br i1 %36, label %37, label %39
37: ; preds = %20
%38 = call i32 @puts(i8* %8)
br label %39
39: ; preds = %20, %37
%40 = load i32, i32* %17
%41 = icmp eq i32 %40, %33
br i1 %41, label %42, label %44
42: ; preds = %39
%43 = call i32 @puts(i8* %16)
br label %44
44: ; preds = %42, %39
%45 = load i32, i32* %19
%46 = icmp eq i32 %45, %33
br i1 %46, label %47, label %49
47: ; preds = %44
%48 = call i32 @puts(i8* %18)
br label %49
49: ; preds = %47, %44
%50 = add nuw nsw i32 %21, 1
%51 = load i32, i32* %3
%52 = icmp slt i32 %21, %51
br i1 %52, label %20, label %53
53: ; preds = %49, %0
ret i32 0
}