#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, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main(void) {
  int n, max[2] = {0}, num, fish, i;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d %d", &num, &fish);
    if (i == 0 || fish > max[1] || (fish == max[1] && num < max[0])) {
      max[0] = num;
      max[1] = fish;
    }
  }
  printf("%d %d\n", max[0], max[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
lea    0xead(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d7 <main+0xa7>
lea    0xe85(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x0,-0x1c(%rbp)
je     11b8 <main+0x88>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11b8 <main+0x88>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11c4 <main+0x94>
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11c4 <main+0x94>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11c9 <main+0x99>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1168 <main+0x38>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe22(%rip),%rdi
call   1030 <printf@plt>
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
lea    0xece(%rip),%rdi
xor    %r13d,%r13d
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x14(%rsp)
mov    $0x0,%ebp
jle    11c5 <main+0xa5>
lea    0xea9(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x10(%rsp),%ebp
mov    0xc(%rsp),%r13d
cmpl   $0x2,0x14(%rsp)
jl     11c5 <main+0xa5>
mov    $0x1,%ebx
lea    0xe7c(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x10(%rsp),%r12
jmp    11a0 <main+0x80>
mov    0xc(%rsp),%r13d
mov    %eax,%ebp
add    $0x1,%ebx
cmp    0x14(%rsp),%ebx
jge    11c5 <main+0xa5>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x10(%rsp),%eax
cmp    %ebp,%eax
jg     1190 <main+0x70>
jne    1197 <main+0x77>
mov    %ebp,%eax
cmp    %r13d,0xc(%rsp)
jl     1190 <main+0x70>
jmp    1197 <main+0x77>
lea    0xe3a(%rip),%rdi
mov    %r13d,%esi
mov    %ebp,%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 = [6 x i8] c"%d %d\00"
@.str.2 = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [2 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [2 x i32]* %3 to i8*
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %6
br label %9
9: ; preds = %38, %0
%10 = load i32, i32* %6
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %41
13: ; preds = %9
%14 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5)
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, 0
br i1 %16, label %32, label %17
17: ; preds = %13
%18 = load i32, i32* %5
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%20 = load i32, i32* %19
%21 = icmp sgt i32 %18, %20
br i1 %21, label %32, label %22
22: ; preds = %17
%23 = load i32, i32* %5
%24 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%25 = load i32, i32* %24
%26 = icmp eq i32 %23, %25
br i1 %26, label %27, label %37
27: ; preds = %22
%28 = load i32, i32* %4
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%30 = load i32, i32* %29
%31 = icmp slt i32 %28, %30
br i1 %31, label %32, label %37
32: ; preds = %27, %17, %13
%33 = load i32, i32* %4
%34 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
store i32 %33, i32* %34
%35 = load i32, i32* %5
%36 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
store i32 %35, i32* %36
br label %37
37: ; preds = %32, %27, %22
br label %38
38: ; preds = %37
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %9
41: ; preds = %9
%42 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%43 = load i32, i32* %42
%44 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%45 = load i32, i32* %44
%46 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %43, i32 %45)
ret i32 0
}

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