d=set()

for _ in[0]*int(eval(input())):

 c,g=input().split()

 if'i'==c[0]:d|=set([g])

 else:print((['no','yes'][g in d]))

d={}

for _ in[0]*int(eval(input())):

 c,g=input().split()

 if'i'==c[0]:d[g]=0

 else:print((['no','yes'][g in d]))

d = set()
for _ in [0] * int(eval(input())):
    c, g = input().split()
    if "i" == c[0]:
        d |= set([g])
    else:
        print((["no", "yes"][g in d]))

d = {}
for _ in [0] * int(eval(input())):
    c, g = input().split()
    if "i" == c[0]:
        d[g] = 0
    else:
        print((["no", "yes"][g in d]))

-d = set() +d = {} -        d |= set([g]) +        d[g] = 0