#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 abs(int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char const *argv[]) {
  int iterations = 0;
  scanf("%d", &iterations);
  int lead1 = 0;
  int lead2 = 0;
  int score1 = 0;
  int score2 = 0;
  int new_lead = 0;
  int temp = 0;
  for (int i = 0; i < iterations; ++i) {
    scanf("%d", &temp);
    score1 += temp;
    scanf("%d", &temp);
    score2 += temp;
    new_lead = score1 - score2;
    if (new_lead < 0) {
      if (lead2 < abs(new_lead)) {
        lead2 = abs(new_lead);
      }
    } else if (new_lead > 0) {
      if (lead1 < abs(new_lead)) {
        lead1 = abs(new_lead);
      }
    }
  }
  if (lead1 < lead2) {
    printf("%d %d\n", 2, lead2);
  } else {
    printf("%d %d\n", 1, lead1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeac(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1257 <main+0x127>
lea    0xe5f(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x2c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
lea    0xe46(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x2c(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
sub    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jge    120a <main+0xda>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
cmp    %ecx,%eax
jge    1205 <main+0xd5>
mov    -0x28(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x1c(%rbp)
jmp    1244 <main+0x114>
cmpl   $0x0,-0x28(%rbp)
jle    123f <main+0x10f>
mov    -0x18(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
cmp    %ecx,%eax
jge    123a <main+0x10a>
mov    -0x28(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x18(%rbp)
jmp    123f <main+0x10f>
jmp    1244 <main+0x114>
jmp    1249 <main+0x119>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    118e <main+0x5e>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    127c <main+0x14c>
mov    -0x1c(%rbp),%edx
lea    0xd96(%rip),%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
jmp    1290 <main+0x160>
mov    -0x18(%rbp),%edx
lea    0xd7d(%rip),%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%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,0x14(%rsp)
lea    0xec3(%rip),%rdi
lea    0x14(%rsp),%rsi
call   1040 <scanf@plt>
movl   $0x0,0x10(%rsp)
cmpl   $0x0,0x14(%rsp)
jle    11dc <main+0xbc>
xor    %ebp,%ebp
xor    %ebx,%ebx
xor    %r14d,%r14d
movl   $0x0,0xc(%rsp)
xor    %r13d,%r13d
jmp    1188 <main+0x68>
xchg   %ax,%ax
neg    %eax
mov    0xc(%rsp),%ecx
cmp    %eax,%ecx
cmovl  %eax,%ecx
mov    %ecx,0xc(%rsp)
add    $0x1,%ebp
cmp    0x14(%rsp),%ebp
jge    11c5 <main+0xa5>
lea    0xe71(%rip),%r15
mov    %r15,%rdi
lea    0x10(%rsp),%r12
mov    %r12,%rsi
call   1040 <scanf@plt>
add    0x10(%rsp),%r14d
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
add    0x10(%rsp),%ebx
mov    %r14d,%eax
sub    %ebx,%eax
js     1170 <main+0x50>
je     117f <main+0x5f>
cmp    %eax,%r13d
cmovl  %eax,%r13d
jmp    117f <main+0x5f>
mov    0xc(%rsp),%edx
cmp    %edx,%r13d
jge    11df <main+0xbf>
lea    0xe2e(%rip),%rdi
mov    $0x2,%esi
jmp    11ee <main+0xce>
xor    %r13d,%r13d
lea    0xe1d(%rip),%rdi
mov    $0x1,%esi
mov    %r13d,%edx
call   1030 <printf@plt>
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 = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
br label %15
15: ; preds = %56, %2
%16 = load i32, i32* %13
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %59
19: ; preds = %15
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%21 = load i32, i32* %12
%22 = load i32, i32* %9
%23 = add nsw i32 %22, %21
store i32 %23, i32* %9
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%25 = load i32, i32* %12
%26 = load i32, i32* %10
%27 = add nsw i32 %26, %25
store i32 %27, i32* %10
%28 = load i32, i32* %9
%29 = load i32, i32* %10
%30 = sub nsw i32 %28, %29
store i32 %30, i32* %11
%31 = load i32, i32* %11
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %42
33: ; preds = %19
%34 = load i32, i32* %8
%35 = load i32, i32* %11
%36 = call i32 @abs(i32 %35)
%37 = icmp slt i32 %34, %36
br i1 %37, label %38, label %41
38: ; preds = %33
%39 = load i32, i32* %11
%40 = call i32 @abs(i32 %39)
store i32 %40, i32* %8
br label %41
41: ; preds = %38, %33
br label %55
42: ; preds = %19
%43 = load i32, i32* %11
%44 = icmp sgt i32 %43, 0
br i1 %44, label %45, label %54
45: ; preds = %42
%46 = load i32, i32* %7
%47 = load i32, i32* %11
%48 = call i32 @abs(i32 %47)
%49 = icmp slt i32 %46, %48
br i1 %49, label %50, label %53
50: ; preds = %45
%51 = load i32, i32* %11
%52 = call i32 @abs(i32 %51)
store i32 %52, i32* %7
br label %53
53: ; preds = %50, %45
br label %54
54: ; preds = %53, %42
br label %55
55: ; preds = %54, %41
br label %56
56: ; preds = %55
%57 = load i32, i32* %13
%58 = add nsw i32 %57, 1
store i32 %58, i32* %13
br label %15
59: ; preds = %15
%60 = load i32, i32* %7
%61 = load i32, i32* %8
%62 = icmp slt i32 %60, %61
br i1 %62, label %63, label %66
63: ; preds = %59
%64 = load i32, i32* %8
%65 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 %64)
br label %69
66: ; preds = %59
%67 = load i32, i32* %7
%68 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %67)
br label %69
69: ; preds = %66, %63
ret i32 0
}

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