//采用了线性、二分(自带、自定义)、散列(自带、自定义)方法
//可根据需要删去对应注释
#include<iostream>
#include<algorithm>#include<unordered_map>
using namespace std;
int s[100];
bool harshtable[1000000];
unordered_map<int, bool>harshtb;
bool linearsearch(int n,int x){//线性查找
for(int i=0;i<n;i++){
if(s[i]==x)return true;
}
return false;
}
bool binarysearch(int left,int right,int x){//二分查找,一定要先保证有序
sort(s+left,s+right+1);
while(left<=right){
int mid=left+(right-left)/2;//避免计算溢出
if(s[mid]<x)return binarysearch(mid+1,right,x);
else if(s[mid]>x)return binarysearch(left,mid-1,x);
else return true;
}
return false;
}
/*int main(){
int n,m,x;
while(scanf("%d",&n)!=EOF){
for(int i=0;i<n;i++)scanf("%d",&s[i]);
scanf("%d",&m);
sort(s,s+n);
while(m--){
scanf("%d",&x);
//if(linearsearch(n,x))printf("YES\n");//线性
//if(binarysearch(0,n-1,x))printf("YES\n");//自定义二分法
int position=lower_bound(s,s+n,x)-s;
if(position!=n&&s[position]==x)printf("YES\n");//自带二分法
else printf("NO\n");
}
}
return 0;
}*/
int main(){
int n,m,x;
while(scanf("%d",&n)!=EOF){
for(int i=0;i<n;i++){
scanf("%d",&s[i]);
//harshtable[s[i]+500000]=true;//为避免负数作为下标,给定偏移量
harshtb[s[i]]=true;
}
scanf("%d",&m);
while(m--){
scanf("%d",&x);
//if(harshtable[x+500000])printf("YES\n");//自定义散列查找
if(harshtb[x])printf("YES\n");//自带散列查找
else printf("NO\n");
}
}
return 0;
}