#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 /*<<< orphan*/ scanf(char *, int *, ...);
int main(void) {
  int terms;
  scanf("%d", &terms);
  while (terms--) {
    int x, y, k, n;
    scanf("%d%d%d%d", &x, &y, &k, &n);
    int req_pages = x - y;
    int i, flag = 0;
    for (i = 1; i <= n; i++) {
      int pi, ci;
      scanf("%d%d", &pi, &ci);
      if (pi >= req_pages && ci <= k)
        flag = 1;
    }
    if (flag)
      printf("LuckyChef\n");
    else
      printf("UnluckyChef\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed0(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     120a <main+0xea>
lea    0xea4(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11de <main+0xbe>
lea    0xe67(%rip),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x28(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     11cb <main+0xab>
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11cb <main+0xab>
movl   $0x1,-0x24(%rbp)
jmp    11d0 <main+0xb0>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    118a <main+0x6a>
cmpl   $0x0,-0x24(%rbp)
je     11f9 <main+0xd9>
lea    0xe1a(%rip),%rdi
call   1030 <printf@plt>
jmp    1205 <main+0xe5>
lea    0xe14(%rip),%rdi
call   1030 <printf@plt>
jmp    1141 <main+0x21>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xed1(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,0x10(%rsp)
jae    1159 <main+0x39>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xea4(%rip),%rbp
lea    0x18(%rsp),%r14
lea    0x14(%rsp),%r15
jmp    1183 <main+0x63>
nopl   0x0(%rax)
lea    0xe92(%rip),%rdi
call   1030 <puts@plt>
subl   $0x1,0x10(%rsp)
jb     1148 <main+0x28>
lea    0xe76(%rip),%rdi
lea    0x24(%rsp),%rsi
lea    0x20(%rsp),%rdx
lea    0x1c(%rsp),%rcx
lea    0xc(%rsp),%r8
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1170 <main+0x50>
mov    0x24(%rsp),%r12d
sub    0x20(%rsp),%r12d
xor    %r13d,%r13d
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
mov    %eax,%ebx
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    0x1c(%rsp),%eax
mov    $0x1,%eax
cmovg  %ebx,%eax
cmp    %r12d,0x18(%rsp)
cmovl  %ebx,%eax
add    $0x1,%r13d
cmp    0xc(%rsp),%r13d
jl     11c0 <main+0xa0>
lea    0xe19(%rip),%rdi
test   %eax,%eax
jne    1177 <main+0x57>
jmp    1170 <main+0x50>

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

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