import sys

readline = sys.stdin.readline

SET = set()

for _ in range(int(readline())):

    c, s = readline().split()

    if c == "insert":

        SET.add(s)

    elif c == "find":

        print(("yes" if s in SET else "no"))



import sys

readline = sys.stdin.readline

SET = set()

eval(input())

for s in sys.stdin:

    if s[0] == "i":

        SET.add(s[7:])

    elif s[0] == "f":

        print(("yes" if s[5:] in SET else "no"))



import sys

readline = sys.stdin.readline
SET = set()
for _ in range(int(readline())):
    c, s = readline().split()
    if c == "insert":
        SET.add(s)
    elif c == "find":
        print(("yes" if s in SET else "no"))

import sys

readline = sys.stdin.readline
SET = set()
eval(input())
for s in sys.stdin:
    if s[0] == "i":
        SET.add(s[7:])
    elif s[0] == "f":
        print(("yes" if s[5:] in SET else "no"))

-for _ in range(int(readline())): -    c, s = readline().split() -    if c == "insert": -        SET.add(s) -    elif c == "find": -        print(("yes" if s in SET else "no")) +eval(input()) +for s in sys.stdin: +    if s[0] == "i": +        SET.add(s[7:]) +    elif s[0] == "f": +        print(("yes" if s[5:] in SET else "no"))