Problem A: Binary Search

Problem A: Binary Search

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 1515  Solved: 565
[Submit][Status][Web Board]

Description

Given a nondecreasing sequence \(a\) with length \(n\). We want to know whether integer \(x\) in the array \(a\) or not.

Input

The 1st line is a positive integer \(n(1⩽ n ⩽ 100000)\)

The 2nd line contains \(n\) integers: \(a_1, a_2, ... a_n\). For each \(a_i (0⩽ a_i ⩽ 10^9)\)

The 3rd line is a positive integer \(T(1⩽ T ⩽ 100000)\) which is the number of test case.

Then \(T\) lines follow. Each contains an integer \(x(1⩽ x ⩽ 10^9)\) for a test case.

Output

For each test case, print "YES" (in a single line, without quotes) if \(x\) is in \(a\), otherwise print "NO".

Sample Input

4
1 2 3 999999
2
99 
3

Sample Output

NO
YES

HINT

[Submit][Status]