import sys

from collections import ChainMap

eval(input())

rp = sys.stdin.readlines()

cm = ChainMap()



for i in rp:

    if i[0] == 'i':

        cm[i[7:]] = 0

    else:

        if i[5:] in cm:

            print('yes')

        else:

            print('no')
import sys

#from collections import ChainMap

eval(input())

rp = sys.stdin.readlines()

cm = {}#ChainMap()



for i in rp:

    if i[0] == 'i':

        cm[i[7:]] = 0

    else:

        if i[5:] in cm:

            print('yes')

        else:

            print('no')
import sys
from collections import ChainMap

eval(input())
rp = sys.stdin.readlines()
cm = ChainMap()
for i in rp:
    if i[0] == "i":
        cm[i[7:]] = 0
    else:
        if i[5:] in cm:
            print("yes")
        else:
            print("no")

import sys

# from collections import ChainMap
eval(input())
rp = sys.stdin.readlines()
cm = {}  # ChainMap()
for i in rp:
    if i[0] == "i":
        cm[i[7:]] = 0
    else:
        if i[5:] in cm:
            print("yes")
        else:
            print("no")

-from collections import ChainMap +# from collections import ChainMap -cm = ChainMap() +cm = {}  # ChainMap()