// ── ABOUT ────────────────────────────────────────────────────────
// Stores UNIQUE elements, NO guaranteed order
// insert / find / erase → O(1) average
// Use when you need fast lookup and don't care about order
 
// ── CREATE & INSERT ──────────────────────────────────────────────
unordered_set<string> s;
s.insert("abc");                         // O(1)
s.insert("xyz");
s.insert("abc");                         // duplicate → ignored
 
// ── FIND (two ways) ──────────────────────────────────────────────
if (s.count("abc"))                      // O(1) → preferred
    cout << "yes\n";
else
    cout << "no\n";
 
if (s.find("abc") != s.end())            // O(1) → alternative
    cout << "yes\n";
 
// ── ERASE ────────────────────────────────────────────────────────
s.erase("abc");                          // O(1)
 
// ── PRACTICAL USE CASE ───────────────────────────────────────────
// Given N strings and Q queries → check if string exists
 
unordered_set<string> dict;
int n; cin >> n;
for (int i = 0; i < n; i++) {
    string str; cin >> str;
    dict.insert(str);
}
int q; cin >> q;
while (q--) {
    string str; cin >> str;
    cout << (dict.count(str) ? "yes" : "no") << "\n";
}