#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__ EOF;
int /*<<< orphan*/ printf(char *, int, int);
scalar_t__ scanf(char *, int *, int *);
int main(void) {
  int mo, af, i, max, shop;
  while (scanf("%d %d", &mo, &af) != EOF && (mo != 0 || af != 0)) {
    shop = 0, max = mo + af;
    for (i = 0; i < 4; i++) {
      scanf("%d %d", &mo, &af);
      if (mo + af > max) {
        max = mo + af;
        shop = i + 1;
      }
    }
    printf("%c %d\n", shop + 'A', max);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    %rax,%rcx
xor    %eax,%eax
mov    0x2e99(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0x19(%rbp)
je     117a <main+0x5a>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x1a(%rbp)
jne    1174 <main+0x54>
cmpl   $0x0,-0xc(%rbp)
setne  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    118a <main+0x6a>
jmp    120d <main+0xed>
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    11f3 <main+0xd3>
lea    0xe4e(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    11e0 <main+0xc0>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11e5 <main+0xc5>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11a1 <main+0x81>
mov    -0x18(%rbp),%esi
add    $0x41,%esi
mov    -0x14(%rbp),%edx
lea    0xe03(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
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
push   %rax
lea    0xece(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
nopw   0x0(%rax,%rax,1)
call   1040 <scanf@plt>
mov    0x2e9c(%rip),%rcx
cmp    (%rcx),%rax
je     1233 <main+0x113>
mov    0x4(%rsp),%eax
mov    (%rsp),%ebx
mov    %eax,%ecx
or     %ebx,%ecx
je     1233 <main+0x113>
add    %eax,%ebx
lea    0xe91(%rip),%r15
mov    %r15,%rdi
lea    0x4(%rsp),%r13
mov    %r13,%rsi
mov    %rsp,%r14
mov    %r14,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%r12d
add    0x4(%rsp),%r12d
xor    %ebp,%ebp
cmp    %ebx,%r12d
setg   %bpl
cmovle %ebx,%r12d
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%ebx
add    0x4(%rsp),%ebx
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
mov    %r14,%r15
call   1040 <scanf@plt>
mov    (%rsp),%r14d
add    0x4(%rsp),%r14d
lea    0xe2f(%rip),%rdi
mov    %r13,%rsi
mov    %r15,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%eax
add    0x4(%rsp),%eax
add    $0x41,%ebp
cmp    %r12d,%ebx
cmovle %r12d,%ebx
mov    $0x43,%ecx
cmovg  %ecx,%ebp
cmp    %ebx,%r14d
cmovg  %r14d,%ebx
mov    $0x44,%ecx
cmovg  %ecx,%ebp
cmp    %ebx,%eax
cmovg  %eax,%ebx
mov    $0x45,%eax
cmovg  %eax,%ebp
lea    0xdee(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
lea    0xdd8(%rip),%rdi
mov    %r13,%rsi
mov    %r15,%rdx
jmp    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@EOF = global i64 0
@.str.1 = [7 x i8] c"%c %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
br label %7
7: ; preds = %45, %0
%8 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%9 = load i64, i64* @EOF
%10 = icmp ne i64 %8, %9
br i1 %10, label %11, label %19
11: ; preds = %7
%12 = load i32, i32* %2
%13 = icmp ne i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load i32, i32* %3
%16 = icmp ne i32 %15, 0
br label %17
17: ; preds = %14, %11
%18 = phi i1 [ true, %11 ], [ %16, %14 ]
br label %19
19: ; preds = %17, %7
%20 = phi i1 [ false, %7 ], [ %18, %17 ]
br i1 %20, label %21, label %50
21: ; preds = %19
store i32 0, i32* %6
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = add nsw i32 %22, %23
store i32 %24, i32* %5
store i32 0, i32* %4
br label %25
25: ; preds = %42, %21
%26 = load i32, i32* %4
%27 = icmp slt i32 %26, 4
br i1 %27, label %28, label %45
28: ; preds = %25
%29 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = add nsw i32 %30, %31
%33 = load i32, i32* %5
%34 = icmp sgt i32 %32, %33
br i1 %34, label %35, label %41
35: ; preds = %28
%36 = load i32, i32* %2
%37 = load i32, i32* %3
%38 = add nsw i32 %36, %37
store i32 %38, i32* %5
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %41
41: ; preds = %35, %28
br label %42
42: ; preds = %41
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %25
45: ; preds = %25
%46 = load i32, i32* %6
%47 = add nsw i32 %46, 65
%48 = load i32, i32* %5
%49 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %47, i32 %48)
br label %7
50: ; preds = %19
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@EOF = global i64 0
@.str.1 = [7 x i8] c"%c %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i64, i64* @EOF
%7 = icmp eq i64 %5, %6
br i1 %7, label %48, label %8
8: ; preds = %0, %14
%9 = load i32, i32* %1
%10 = icmp ne i32 %9, 0
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, 0
%13 = select i1 %10, i1 true, i1 %12
br i1 %13, label %14, label %48
14: ; preds = %8
%15 = add nsw i32 %11, %9
%16 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = add nsw i32 %18, %17
%20 = icmp sgt i32 %19, %15
%21 = select i1 %20, i32 %19, i32 %15
%22 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%23 = load i32, i32* %1
%24 = load i32, i32* %2
%25 = add nsw i32 %24, %23
%26 = icmp sgt i32 %25, %21
%27 = select i1 %26, i32 %25, i32 %21
%28 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%29 = load i32, i32* %1
%30 = load i32, i32* %2
%31 = add nsw i32 %30, %29
%32 = icmp sgt i32 %31, %27
%33 = select i1 %32, i32 %31, i32 %27
%34 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%35 = load i32, i32* %1
%36 = load i32, i32* %2
%37 = add nsw i32 %36, %35
%38 = icmp sgt i32 %37, %33
%39 = select i1 %38, i32 %37, i32 %33
%40 = select i1 %20, i32 66, i32 65
%41 = select i1 %26, i32 67, i32 %40
%42 = select i1 %32, i32 68, i32 %41
%43 = select i1 %38, i32 69, i32 %42
%44 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %43, i32 %39)
%45 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%46 = load i64, i64* @EOF
%47 = icmp eq i64 %45, %46
br i1 %47, label %48, label %8
48: ; preds = %8, %14, %0
ret i32 0
}