#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 check(int *, int *, int, int);
int /*<<< orphan*/ input(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int N1, A1[20], N2, A2[20], b;
  scanf("%d", &N1);
  input(A1, N1);
  scanf("%d", &N2);
  input(A2, N2);
  b = check(A1, A2, N1, N2);
  if (b == 1)
    printf("YES\n");
  else if (b == -1)
    printf("NO\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <input@plt>
lea    0xe8b(%rip),%rdi
lea    -0x64(%rbp),%rsi
call   1050 <scanf@plt>
lea    -0xc0(%rbp),%rdi
mov    -0x64(%rbp),%esi
call   1030 <input@plt>
lea    -0x60(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
mov    -0x8(%rbp),%edx
mov    -0x64(%rbp),%ecx
call   1060 <check@plt>
mov    %eax,-0xc4(%rbp)
cmpl   $0x1,-0xc4(%rbp)
jne    11c7 <main+0x87>
lea    0xe46(%rip),%rdi
call   1040 <printf@plt>
jmp    11e5 <main+0xa5>
cmpl   $0xffffffff,-0xc4(%rbp)
jne    11e0 <main+0xa0>
lea    0xe2d(%rip),%rdi
call   1040 <printf@plt>
jmp    11e5 <main+0xa5>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xb8,%rsp
lea    0xeaf(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0x60(%rsp),%r14
mov    %r14,%rdi
call   1030 <input@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x8(%rsp),%esi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <input@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <check@plt>
cmp    $0x1,%eax
je     11b3 <main+0x73>
cmp    $0xffffffff,%eax
jne    11bf <main+0x7f>
lea    0xe52(%rip),%rdi
jmp    11ba <main+0x7a>
lea    0xe4c(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"YES\0A\00"
@.str.2 = [4 x i8] c"NO\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x i32]
%4 = alloca i32
%5 = alloca [20 x i32]
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%9 = load i32, i32* %2
%10 = call i32 @input(i32* %8, i32 %9)
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%12 = getelementptr inbounds [20 x i32], [20 x i32]* %5, i64 0, i64 0
%13 = load i32, i32* %4
%14 = call i32 @input(i32* %12, i32 %13)
%15 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%16 = getelementptr inbounds [20 x i32], [20 x i32]* %5, i64 0, i64 0
%17 = load i32, i32* %2
%18 = load i32, i32* %4
%19 = call i32 @check(i32* %15, i32* %16, i32 %17, i32 %18)
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %24
22: ; preds = %0
%23 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %30
24: ; preds = %0
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, -1
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %27, %24
br label %30
30: ; preds = %29, %22
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [3 x i8] c"NO\00"
@str.3 = [4 x i8] c"YES\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i32]
%3 = alloca i32
%4 = alloca [20 x i32]
%5 = bitcast i32* %1 to i8*
%6 = bitcast [20 x i32]* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast [20 x i32]* %4 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%10 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%11 = load i32, i32* %1
%12 = call i32 @input(i32* %10, i32 %11)
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%14 = getelementptr inbounds [20 x i32], [20 x i32]* %4, i64 0, i64 0
%15 = load i32, i32* %3
%16 = call i32 @input(i32* %14, i32 %15)
%17 = load i32, i32* %1
%18 = load i32, i32* %3
%19 = call i32 @check(i32* %10, i32* %14, i32 %17, i32 %18)
switch i32 %19, label %24 [
i32 1, label %21
i32 -1, label %20
]
20: ; preds = %0
br label %21
21: ; preds = %0, %20
%22 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0), %20 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.3, i64 0, i64 0), %0 ]
%23 = call i32 @puts(i8* dereferenceable(1) %22)
br label %24
24: ; preds = %21, %0
ret i32 0
}