#include <iostream> #include <algorithm> using namespace std; int main() { int n,m; while(cin>>n){ int *A = (int*)malloc(sizeof(int)*(n)); for(int i=0;i<n;i++) cin>>A[i]; sort(A, A+n); cin>>m; int *B = (int*)malloc(sizeof(int)*(m)); for(int i=0; i<m; i++) cin>>B[i]; for(int i=0;i<m;i++){ int left=0,right=n-1; while(left<=right){ int mid=(left + right) / 2; if(A[mid] == B[i]) {cout<<"YES\n"; break;} else if(A[mid] > B[i]) right = mid - 1; else left = mid + 1; } if(left > right) cout<<"NO\n"; } } return 0; }