dic = {}

for s in range(int(eval(input()))):

    i = input().split()

    if i[0] == "insert":

        dic[i[1]] = None

    else:

        print(("yes" if i[1] in dic else "no"))
dic = {}

line = []

for i in range(int(eval(input()))):

    line.append(input().split())

for i in line:

    if i[0][0] == "i":

        dic[i[1]] = None

    else:

        print(("yes" if i[1] in dic else "no"))
dic = {}
for s in range(int(eval(input()))):
    i = input().split()
    if i[0] == "insert":
        dic[i[1]] = None
    else:
        print(("yes" if i[1] in dic else "no"))

dic = {}
line = []
for i in range(int(eval(input()))):
    line.append(input().split())
for i in line:
    if i[0][0] == "i":
        dic[i[1]] = None
    else:
        print(("yes" if i[1] in dic else "no"))

-for s in range(int(eval(input()))): -    i = input().split() -    if i[0] == "insert": +line = [] +for i in range(int(eval(input()))): +    line.append(input().split()) +for i in line: +    if i[0][0] == "i":