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(6710886)]

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")

            
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")

            
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(6710886)]
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")

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")

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