import sys

d={}

for e in sys.stdin.readlines()[1:]:

 c,g=e.split()

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

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

import sys

d={}

for e in sys.stdin.readlines()[1:]:

 if'i'==e[0]:d[e[7:]]=0

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

import sys

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

import sys

d = {}
for e in sys.stdin.readlines()[1:]:
    if "i" == e[0]:
        d[e[7:]] = 0
    else:
        print((["no", "yes"][e[5:] in d]))

-    c, g = e.split() -    if "i" == c[0]: -        d[g] = 0 +    if "i" == e[0]: +        d[e[7:]] = 0 -        print((["no", "yes"][g in d])) +        print((["no", "yes"][e[5:] in d]))