#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 INT_MAX;
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int time_to_int(char *);
int main() {
  int n;
  scanf("%d", &n);
  char temp_id[18], temp_time1[10], temp_time2[10], login_in_id[18],
      login_out_id[18];
  int login_in = INT_MAX, login_out = -1, time1, time2;
  for (int i = 0; i < n; ++i) {
    scanf("%s %s %s", temp_id, temp_time1, temp_time2);
    time1 = time_to_int(temp_time1);
    time2 = time_to_int(temp_time2);
    if (time1 < login_in) {
      strcpy(login_in_id, temp_id);
      login_in = time1;
    }
    if (time2 > login_out) {
      strcpy(login_out_id, temp_id);
      login_out = time2;
    }
  }
  printf("%s %s\n", login_in_id, login_out_id);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    0x2e7d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
movl   $0xffffffff,-0x78(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1219 <main+0xd9>
lea    -0x20(%rbp),%rsi
lea    -0x2a(%rbp),%rdx
lea    -0x34(%rbp),%rcx
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x2a(%rbp),%rdi
call   1050 <time_to_int@plt>
mov    %eax,-0x7c(%rbp)
lea    -0x34(%rbp),%rdi
call   1050 <time_to_int@plt>
mov    %eax,-0x80(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x74(%rbp),%eax
jge    11e1 <main+0xa1>
lea    -0x50(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x7c(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x80(%rbp),%eax
cmp    -0x78(%rbp),%eax
jle    1200 <main+0xc0>
lea    -0x70(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x80(%rbp),%eax
mov    %eax,-0x78(%rbp)
jmp    1205 <main+0xc5>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1181 <main+0x41>
lea    -0x50(%rbp),%rsi
lea    -0x70(%rbp),%rdx
lea    0xde4(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
lea    0xeab(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11fe <main+0xbe>
mov    0x2e75(%rip),%rax
mov    (%rax),%r14d
mov    $0xffffffff,%r12d
lea    0x64(%rsp),%rbx
xor    %r15d,%r15d
jmp    119b <main+0x5b>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r15d
cmp    0xc(%rsp),%r15d
jge    11fe <main+0xbe>
lea    0xe61(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x6e(%rsp),%rbp
mov    %rbp,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %rbp,%rdi
call   1050 <time_to_int@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <time_to_int@plt>
mov    %eax,%r13d
cmp    %r14d,%ebp
jge    11e5 <main+0xa5>
lea    0x50(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1030 <strcpy@plt>
mov    %ebp,%r14d
cmp    %r12d,%r13d
jle    1190 <main+0x50>
lea    0x30(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1030 <strcpy@plt>
mov    %r13d,%r12d
jmp    1190 <main+0x50>
lea    0xe07(%rip),%rdi
lea    0x50(%rsp),%rsi
lea    0x30(%rsp),%rdx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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