#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 */
scalar_t__ EOF;
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
scalar_t__ scanf(char *, int *);
int main() {
  int n, m, i, j, tmp, flag;
  int *array;
  while (scanf("%d", &n) != EOF) {
    array = (int *)malloc(n * sizeof(int));
    for (i = 0; i < n; i++)
      scanf("%d", &array[i]);
    scanf("%d", &m);
    for (i = 0; i < m; i++) {
      scanf("%d", &tmp);
      flag = 0;
      for (j = 0; j < n; j++) {
        if (tmp == array[j]) {
          printf("YES\n");
          flag = 1;
        }
      }
      if (!flag)
        printf("NO\n");
    }
    free(array);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    0x2e82(%rip),%rcx
cmp    (%rcx),%rax
je     127c <main+0x13c>
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11be <main+0x7e>
mov    -0x28(%rbp),%rsi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe55(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1189 <main+0x49>
lea    0xe3b(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    126e <main+0x12e>
lea    0xe18(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1245 <main+0x105>
mov    -0x18(%rbp),%eax
mov    -0x28(%rbp),%rcx
movslq -0x14(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    1232 <main+0xf2>
lea    0xddd(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x1c(%rbp)
jmp    1237 <main+0xf7>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ff <main+0xbf>
cmpl   $0x0,-0x1c(%rbp)
jne    125b <main+0x11b>
lea    0xdb2(%rip),%rdi
call   1040 <printf@plt>
jmp    1260 <main+0x120>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11d5 <main+0x95>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
jmp    114f <main+0xf>
xor    %eax,%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    $0x18,%rsp
lea    0xeab(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x2e82(%rip),%rcx
cmp    (%rcx),%rax
jne    117c <main+0x3c>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe7d(%rip),%r12
lea    0x14(%rsp),%r15
lea    0xe77(%rip),%r13
jmp    11c1 <main+0x81>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x2e2c(%rip),%rcx
cmp    (%rcx),%rax
je     116b <main+0x2b>
mov    0xc(%rsp),%edi
shl    $0x2,%edi
call   1050 <malloc@plt>
mov    %rax,%rbp
cmpl   $0x0,0xc(%rsp)
jle    11fd <main+0xbd>
mov    %rbp,%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %r14,%rsi
call   1060 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
add    $0x4,%r14
cmp    %rax,%rbx
jl     11e0 <main+0xa0>
mov    %r12,%rdi
lea    0x10(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0x10(%rsp)
jle    11a0 <main+0x60>
xor    %r14d,%r14d
jmp    123b <main+0xfb>
cs nopw 0x0(%rax,%rax,1)
lea    0xddc(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r14d
cmp    0x10(%rsp),%r14d
jge    11a0 <main+0x60>
mov    %r12,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1220 <main+0xe0>
xor    %ebx,%ebx
xor    %ecx,%ecx
jmp    126c <main+0x12c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
movslq %eax,%rdx
cmp    %rdx,%rbx
jge    1290 <main+0x150>
mov    0x14(%rsp),%edx
cmp    0x0(%rbp,%rbx,4),%edx
jne    1260 <main+0x120>
mov    %r13,%rdi
call   1040 <puts@plt>
mov    $0x1,%ecx
mov    0xc(%rsp),%eax
jmp    1260 <main+0x120>
nopl   0x0(%rax)
test   %ecx,%ecx
jne    122c <main+0xec>
jmp    1220 <main+0xe0>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.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 i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
store i32 0, i32* %1
br label %9
9: ; preds = %68, %0
%10 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%11 = load i64, i64* @EOF
%12 = icmp ne i64 %10, %11
br i1 %12, label %13, label %71
13: ; preds = %9
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = mul i64 %15, 4
%17 = trunc i64 %16 to i32
%18 = call i64 @malloc(i32 %17)
%19 = inttoptr i64 %18 to i32*
store i32* %19, i32** %8
store i32 0, i32* %4
br label %20
20: ; preds = %30, %13
%21 = load i32, i32* %4
%22 = load i32, i32* %2
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %33
24: ; preds = %20
%25 = load i32*, i32** %8
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
%29 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %28)
br label %30
30: ; preds = %24
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %20
33: ; preds = %20
%34 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %4
br label %35
35: ; preds = %65, %33
%36 = load i32, i32* %4
%37 = load i32, i32* %3
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %68
39: ; preds = %35
%40 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
store i32 0, i32* %7
store i32 0, i32* %5
br label %41
41: ; preds = %56, %39
%42 = load i32, i32* %5
%43 = load i32, i32* %2
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %59
45: ; preds = %41
%46 = load i32, i32* %6
%47 = load i32*, i32** %8
%48 = load i32, i32* %5
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i32, i32* %47, i64 %49
%51 = load i32, i32* %50
%52 = icmp eq i32 %46, %51
br i1 %52, label %53, label %55
53: ; preds = %45
%54 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %7
br label %55
55: ; preds = %53, %45
br label %56
56: ; preds = %55
%57 = load i32, i32* %5
%58 = add nsw i32 %57, 1
store i32 %58, i32* %5
br label %41
59: ; preds = %41
%60 = load i32, i32* %7
%61 = icmp ne i32 %60, 0
br i1 %61, label %64, label %62
62: ; preds = %59
%63 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %64
64: ; preds = %62, %59
br label %65
65: ; preds = %64
%66 = load i32, i32* %4
%67 = add nsw i32 %66, 1
store i32 %67, i32* %4
br label %35
68: ; preds = %35
%69 = load i32*, i32** %8
%70 = call i32 @free(i32* %69)
br label %9
71: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@str = [3 x i8] c"NO\00"
@str.3 = [4 x i8] c"YES\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 i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i64, i64* @EOF
%9 = icmp eq i64 %7, %8
br i1 %9, label %64, label %10
10: ; preds = %0, %59
%11 = load i32, i32* %1
%12 = shl i32 %11, 2
%13 = call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i32*
%15 = load i32, i32* %1
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %25
17: ; preds = %10, %17
%18 = phi i64 [ %21, %17 ], [ 0, %10 ]
%19 = getelementptr inbounds i32, i32* %14, i64 %18
%20 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %19)
%21 = add nuw nsw i64 %18, 1
%22 = load i32, i32* %1
%23 = sext i32 %22 to i64
%24 = icmp slt i64 %21, %23
br i1 %24, label %17, label %25
25: ; preds = %17, %10
%26 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%27 = load i32, i32* %2
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %59
29: ; preds = %25, %55
%30 = phi i32 [ %56, %55 ], [ 0, %25 ]
%31 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%32 = load i32, i32* %1
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %53
34: ; preds = %29, %45
%35 = phi i32 [ %46, %45 ], [ %32, %29 ]
%36 = phi i64 [ %48, %45 ], [ 0, %29 ]
%37 = phi i32 [ %47, %45 ], [ 0, %29 ]
%38 = load i32, i32* %3
%39 = getelementptr inbounds i32, i32* %14, i64 %36
%40 = load i32, i32* %39
%41 = icmp eq i32 %38, %40
br i1 %41, label %42, label %45
42: ; preds = %34
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.3, i64 0, i64 0))
%44 = load i32, i32* %1
br label %45
45: ; preds = %34, %42
%46 = phi i32 [ %44, %42 ], [ %35, %34 ]
%47 = phi i32 [ 1, %42 ], [ %37, %34 ]
%48 = add nuw nsw i64 %36, 1
%49 = sext i32 %46 to i64
%50 = icmp slt i64 %48, %49
br i1 %50, label %34, label %51
51: ; preds = %45
%52 = icmp eq i32 %47, 0
br i1 %52, label %53, label %55
53: ; preds = %29, %51
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
br label %55
55: ; preds = %51, %53
%56 = add nuw nsw i32 %30, 1
%57 = load i32, i32* %2
%58 = icmp slt i32 %56, %57
br i1 %58, label %29, label %59
59: ; preds = %55, %25
%60 = call i32 @free(i32* %14)
%61 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%62 = load i64, i64* @EOF
%63 = icmp eq i64 %61, %62
br i1 %63, label %64, label %10
64: ; preds = %59, %0
ret i32 0
}