#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 main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    double bx, by;
    scanf("%lf %lf", &bx, &by);
    int c;
    scanf("%d", &c);
    int found = 0;
    while (c--) {
      double cx, cy;
      scanf("%lf %lf", &cx, &cy);
      double dx = cx - bx, dy = cy - by;
      dx *= dx;
      dy *= dy;
      if (dx + dy <= 64) {
        found = 1;
        while (c--)
          scanf("%lf %lf", &cx, &cy);
        c = 0;
      }
    }
    printf(found ? "light a candle\n" : "curse the darkness\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%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     126a <main+0x14a>
lea    0xeaf(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe96(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
je     1248 <main+0x128>
lea    0xe6c(%rip),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  -0x28(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm1
addsd  -0x40(%rbp),%xmm1
movsd  0xe04(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1243 <main+0x123>
movl   $0x1,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
je     123c <main+0x11c>
lea    0xde3(%rip),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
jmp    120d <main+0xed>
movl   $0x0,-0x1c(%rbp)
jmp    1184 <main+0x64>
mov    -0x20(%rbp),%ecx
lea    0xdd1(%rip),%rdi
lea    0xdba(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
call   1030 <printf@plt>
jmp    1141 <main+0x21>
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    $0x28,%rsp
lea    0xed3(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,0x4(%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    0xeab(%rip),%rbx
lea    0xea1(%rip),%r12
mov    %rsp,%r13
lea    0xeb2(%rip),%r15
lea    0x10(%rsp),%rbp
lea    0x8(%rsp),%r14
jmp    119a <main+0x7a>
nopl   (%rax)
movl   $0xffffffff,(%rsp)
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
subl   $0x1,0x4(%rsp)
jb     1148 <main+0x28>
mov    %rbx,%rdi
lea    0x20(%rsp),%rsi
lea    0x18(%rsp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,(%rsp)
mov    %r15,%rdi
jb     118e <main+0x6e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
movsd  0x10(%rsp),%xmm0
movhpd 0x8(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movhpd 0x18(%rsp),%xmm1
subpd  %xmm1,%xmm0
mulpd  %xmm0,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  0xdec(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    (%rsp),%eax
jae    1230 <main+0x110>
sub    $0x1,%eax
mov    %eax,(%rsp)
jae    11d0 <main+0xb0>
mov    %r15,%rdi
jmp    118e <main+0x6e>
nopl   (%rax)
sub    $0x1,%eax
mov    %eax,(%rsp)
jb     1180 <main+0x60>
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,(%rsp)
jae    1240 <main+0x120>
jmp    1180 <main+0x60>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [8 x i8] c"%lf %lf\00"
@.str.2 = [16 x i8] c"light a candle\0A\00"
@.str.3 = [20 x i8] c"curse the darkness\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 0, i32* %1
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %12
12: ; preds = %50, %0
%13 = load i32, i32* %2
%14 = add nsw i32 %13, -1
store i32 %14, i32* %2
%15 = icmp ne i32 %13, 0
br i1 %15, label %16, label %56
16: ; preds = %12
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %3, double* %4)
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
store i32 0, i32* %6
br label %19
19: ; preds = %49, %16
%20 = load i32, i32* %5
%21 = add nsw i32 %20, -1
store i32 %21, i32* %5
%22 = icmp ne i32 %20, 0
br i1 %22, label %23, label %50
23: ; preds = %19
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %7, double* %8)
%25 = load double, double* %7
%26 = load double, double* %3
%27 = fsub double %25, %26
store double %27, double* %9
%28 = load double, double* %8
%29 = load double, double* %4
%30 = fsub double %28, %29
store double %30, double* %10
%31 = load double, double* %9
%32 = load double, double* %9
%33 = fmul double %32, %31
store double %33, double* %9
%34 = load double, double* %10
%35 = load double, double* %10
%36 = fmul double %35, %34
store double %36, double* %10
%37 = load double, double* %9
%38 = load double, double* %10
%39 = fadd double %37, %38
%40 = fcmp ole double %39, 6.400000e+01
br i1 %40, label %41, label %49
41: ; preds = %23
store i32 1, i32* %6
br label %42
42: ; preds = %46, %41
%43 = load i32, i32* %5
%44 = add nsw i32 %43, -1
store i32 %44, i32* %5
%45 = icmp ne i32 %43, 0
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %7, double* %8)
br label %42
48: ; preds = %42
store i32 0, i32* %5
br label %49
49: ; preds = %48, %23
br label %19
50: ; preds = %19
%51 = load i32, i32* %6
%52 = icmp ne i32 %51, 0
%53 = zext i1 %52 to i64
%54 = select i1 %52, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0)
%55 = call i32 @printf(i8* %54)
br label %12
56: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [8 x i8] c"%lf %lf\00"
@.str.2 = [16 x i8] c"light a candle\0A\00"
@.str.3 = [20 x i8] c"curse the darkness\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%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 = load i32, i32* %1
%10 = add nsw i32 %9, -1
store i32 %10, i32* %1
%11 = icmp eq i32 %9, 0
br i1 %11, label %59, label %12
12: ; preds = %0
%13 = bitcast double* %2 to i8*
%14 = bitcast double* %3 to i8*
%15 = bitcast i32* %4 to i8*
%16 = bitcast double* %5 to i8*
%17 = bitcast double* %6 to i8*
br label %18
18: ; preds = %12, %53
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %3)
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%21 = load i32, i32* %4
%22 = add nsw i32 %21, -1
store i32 %22, i32* %4
%23 = icmp eq i32 %21, 0
br i1 %23, label %53, label %24
24: ; preds = %18, %49
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %5, double* %6)
%26 = load double, double* %5
%27 = load double, double* %2
%28 = load double, double* %6
%29 = load double, double* %3
%30 = insertelement <2 x double> poison, double %26, i64 0
%31 = insertelement <2 x double> %30, double %28, i64 1
%32 = insertelement <2 x double> poison, double %27, i64 0
%33 = insertelement <2 x double> %32, double %29, i64 1
%34 = fsub <2 x double> %31, %33
%35 = fmul <2 x double> %34, %34
%36 = shufflevector <2 x double> %35, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%37 = fadd <2 x double> %35, %36
%38 = extractelement <2 x double> %37, i64 0
%39 = fcmp ugt double %38, 6.400000e+01
%40 = load i32, i32* %4
br i1 %39, label %49, label %41
41: ; preds = %24
%42 = add nsw i32 %40, -1
store i32 %42, i32* %4
%43 = icmp eq i32 %40, 0
br i1 %43, label %52, label %44
44: ; preds = %41, %44
%45 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double* %5, double* %6)
%46 = load i32, i32* %4
%47 = add nsw i32 %46, -1
store i32 %47, i32* %4
%48 = icmp eq i32 %46, 0
br i1 %48, label %52, label %44
49: ; preds = %24
%50 = add nsw i32 %40, -1
store i32 %50, i32* %4
%51 = icmp eq i32 %40, 0
br i1 %51, label %53, label %24
52: ; preds = %44, %41
store i32 -1, i32* %4
br label %53
53: ; preds = %49, %18, %52
%54 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), %52 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), %18 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), %49 ]
%55 = call i32 @printf(i8* dereferenceable(1) %54)
%56 = load i32, i32* %1
%57 = add nsw i32 %56, -1
store i32 %57, i32* %1
%58 = icmp eq i32 %56, 0
br i1 %58, label %59, label %18
59: ; preds = %53, %0
ret i32 0
}