import sys

eval(input())

rl = sys.stdin.readlines()

d = {}



for i in rl:

    c, s = i.split()

    #if i[0] == 'i':

    if c[0] == 'i':

        #d[i[7:]] = 0

        d[s] = 0

    else:

        #if i[5:] in d:

        if s in d:

            print('yes')

        else:

            print('no')
import sys

eval(input())

r = sys.stdin.readlines()

d = {}



for i in r:

    if i[0] == 'i':

        d[i[7:]] = 0

    else:

        print(('yes' if i[5:] in d else 'no'))
import sys

eval(input())
rl = sys.stdin.readlines()
d = {}
for i in rl:
    c, s = i.split()
    # if i[0] == 'i':
    if c[0] == "i":
        # d[i[7:]] = 0
        d[s] = 0
    else:
        # if i[5:] in d:
        if s in d:
            print("yes")
        else:
            print("no")

import sys

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

-rl = sys.stdin.readlines() +r = sys.stdin.readlines() -for i in rl: -    c, s = i.split() -    # if i[0] == 'i': -    if c[0] == "i": -        # d[i[7:]] = 0 -        d[s] = 0 +for i in r: +    if i[0] == "i": +        d[i[7:]] = 0 -        # if i[5:] in d: -        if s in d: -            print("yes") -        else: -            print("no") +        print(("yes" if i[5:] in d else "no"))