n = int(eval(input()))

  

s = set()

for i in range(n):

    c, m = input().split()

    if c[0] == 'i':

        s.add(m)

    elif c[0] == 'f':

        if m in s:

            print('yes')

        else:

            print('no')
n = int(input())

  

l = []

s = {}

for i in range(n):

    c, m = input().split()

    if c[0] == 'i':

        s[m] = 0

    elif c[0] == 'f':

        if m in s:

            l.append('yes')

        else:

            l.append('no')

print(*l,sep='\n')

n = int(eval(input()))
s = set()
for i in range(n):
    c, m = input().split()
    if c[0] == "i":
        s.add(m)
    elif c[0] == "f":
        if m in s:
            print("yes")
        else:
            print("no")

n = int(input())
l = []
s = {}
for i in range(n):
    c, m = input().split()
    if c[0] == "i":
        s[m] = 0
    elif c[0] == "f":
        if m in s:
            l.append("yes")
        else:
            l.append("no")
print(*l, sep="\n")

-n = int(eval(input())) -s = set() +n = int(input()) +l = [] +s = {} -        s.add(m) +        s[m] = 0 -            print("yes") +            l.append("yes") -            print("no") +            l.append("no") +print(*l, sep="\n")