n = int( eval(input( )) )

dic = {}

output = []

for i in range( n ):

	cmd, word = input( ).split( " " )

	if "insert" == cmd:

		dic[ word ] = True

	elif "find" == cmd:

		try:

			dic[ word ]

			output.append( "yes" )

		except KeyError:

			output.append( "no" )



print(( "\n".join( output ) ))
n = int( input( ) )

dic = {}

output = []

for i in range( n ):

	cmd, word = input( ).split( " " )

	if "insert" == cmd:

		dic[ word ] = True

	elif "find" == cmd:

		if not dic.get( word ):

			output.append( "no" )

		else:

			output.append( "yes" )



print(( "\n".join( output ) ))
n = int(eval(input()))
dic = {}
output = []
for i in range(n):
    cmd, word = input().split(" ")
    if "insert" == cmd:
        dic[word] = True
    elif "find" == cmd:
        try:
            dic[word]
            output.append("yes")
        except KeyError:
            output.append("no")
print(("\n".join(output)))

n = int(input())
dic = {}
output = []
for i in range(n):
    cmd, word = input().split(" ")
    if "insert" == cmd:
        dic[word] = True
    elif "find" == cmd:
        if not dic.get(word):
            output.append("no")
        else:
            output.append("yes")
print(("\n".join(output)))

-n = int(eval(input())) +n = int(input()) -        try: -            dic[word] +        if not dic.get(word): +            output.append("no") +        else: -        except KeyError: -            output.append("no")