#include <iostream> using namespace std; int main() { int n, m, f = 0; cin >> n; int* a = (int*)malloc(sizeof(int) * n); for (int i = 0; i < n; ++i) { cin >> a[i]; } 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) { f = 0; for (int j = 0; j < n; ++j) { if (a[j] == b[i]) { f = 1; std::cout << "YES" << std::endl; break;//主动退出循环 } } if (f == 0) { std::cout << "NO" << std::endl; } } }