dict = {"A":1,"C":2,"G":3,"T":4}

def a2n(a):

	ans = 0

	for i in range(len(a)):

		ans += dict[a[i]]*4**i

	return ans

	

n = int(input())

ls = [0 for i in range(3000000)]

for i in range(n):

    inp = input()

    if inp[0] == "i":

        ls[a2n(inp[7:])] = 1

    else:

        print("yes" if ls[a2n(inp[5:])] else "no")

            
n = int(input())

ls = {}

for i in range(n):

    inp = input()

    if inp[0] == "i":

        ls[inp[7:]] = 1

    else:

        try:

        	if ls[inp[5:]] == 1: print("yes")

        except:

        	print("no")

            
dict = {"A": 1, "C": 2, "G": 3, "T": 4}


def a2n(a):
    ans = 0
    for i in range(len(a)):
        ans += dict[a[i]] * 4**i
    return ans


n = int(input())
ls = [0 for i in range(3000000)]
for i in range(n):
    inp = input()
    if inp[0] == "i":
        ls[a2n(inp[7:])] = 1
    else:
        print("yes" if ls[a2n(inp[5:])] else "no")

n = int(input())
ls = {}
for i in range(n):
    inp = input()
    if inp[0] == "i":
        ls[inp[7:]] = 1
    else:
        try:
            if ls[inp[5:]] == 1:
                print("yes")
        except:
            print("no")

-dict = {"A": 1, "C": 2, "G": 3, "T": 4} - - -def a2n(a): -    ans = 0 -    for i in range(len(a)): -        ans += dict[a[i]] * 4**i -    return ans - - -ls = [0 for i in range(3000000)] +ls = {} -        ls[a2n(inp[7:])] = 1 +        ls[inp[7:]] = 1 -        print("yes" if ls[a2n(inp[5:])] else "no") +        try: +            if ls[inp[5:]] == 1: +                print("yes") +        except: +            print("no")