import sys

d=set()

eval(input())

for e in sys.stdin:

 c,g=e.split()

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

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

import sys

d={}

eval(input())

for e in sys.stdin:

 c,g=e.split()

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

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

import sys

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

import sys

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

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