#!/usr/bin/env python
#-*- coding:utf-8 -*-

ARRY_SIZE = 1000003

def hash1(key):
	return key % (ARRY_SIZE)

def hash2(key):
	return 1 + (key % (ARRY_SIZE - 1))

def hash_combo(key, i):
	return (hash1(key) + i * hash2(key)) % ARRY_SIZE

def insert(arr,key):
	i = 0

	while True:
		j = hash_combo(key, i)
		if arr[j] == "":
			arr[j] = key
			return True
		else:
			i +=  1

def find(arr, key):
	i = 0
	while True:
		j = hash_combo(key,i)
		if arr[j] == key:
			return True
		elif arr[j] == "" or i >= ARRY_SIZE:
			return False
		else:
			i += 1

def getKey(pre_key):
	key =[]
	for pk in pre_key:
		if pk == "A":
			key.append(1)
		elif pk == "C":
			key.append(2)
		elif pk == "G":
			key.append(3)
		else:
			key.append(4)
	return int("".join(map(str,key)))
		
	


def main():
	N = int(raw_input())
	cmd = [raw_input().split() for _ in range(N)]
	dic = [""] * ARRY_SIZE

	for i in range(N):
		if cmd[i][0] == "insert":
			insert(dic, getKey(cmd[i][1]))
		elif cmd[i][0] == "find":
			if find(dic, getKey(cmd[i][1])):
				print "yes"
			else:
				print "no"



#def test():

if __name__ == '__main__':
	main()
	#test() ARRY_SIZE = 1000003 ARRY_SIZE 1000003 def hash1(key):
	return key % (ARRY_SIZE) hash1 return key % (ARRY_SIZE) key % (ARRY_SIZE) key ARRY_SIZE key key def hash2(key):
	return 1 + (key % (ARRY_SIZE - 1)) hash2 return 1 + (key % (ARRY_SIZE - 1)) 1 + (key % (ARRY_SIZE - 1)) 1 key % (ARRY_SIZE - 1) key ARRY_SIZE - 1 ARRY_SIZE 1 key key def hash_combo(key, i):
	return (hash1(key) + i * hash2(key)) % ARRY_SIZE hash_combo return (hash1(key) + i * hash2(key)) % ARRY_SIZE (hash1(key) + i * hash2(key)) % ARRY_SIZE hash1(key) + i * hash2(key) hash1(key) hash1 key i * hash2(key) i hash2(key) hash2 key ARRY_SIZE key key i i def insert(arr,key):
	i = 0

	while True:
		j = hash_combo(key, i)
		if arr[j] == "":
			arr[j] = key
			return True
		else:
			i +=  1 insert i = 0 i 0 while True:
		j = hash_combo(key, i)
		if arr[j] == "":
			arr[j] = key
			return True
		else:
			i +=  1 True j = hash_combo(key, i) j hash_combo(key, i) hash_combo key i if arr[j] == "":
			arr[j] = key
			return True
		else:
			i +=  1 arr[j] == "" arr[j] arr j "" arr[j] = key arr[j] arr j key return True True i +=  1 i 1 arr arr key key def find(arr, key):
	i = 0
	while True:
		j = hash_combo(key,i)
		if arr[j] == key:
			return True
		elif arr[j] == "" or i >= ARRY_SIZE:
			return False
		else:
			i += 1 find i = 0 i 0 while True:
		j = hash_combo(key,i)
		if arr[j] == key:
			return True
		elif arr[j] == "" or i >= ARRY_SIZE:
			return False
		else:
			i += 1 True j = hash_combo(key,i) j hash_combo(key,i) hash_combo key i if arr[j] == key:
			return True
		elif arr[j] == "" or i >= ARRY_SIZE:
			return False
		else:
			i += 1 arr[j] == key arr[j] arr j key return True True elif arr[j] == "" or i >= ARRY_SIZE:
			return False
		 arr[j] == "" or i >= ARRY_SIZE arr[j] == "" arr[j] arr j "" i >= ARRY_SIZE i ARRY_SIZE return False False i += 1 i 1 arr arr key key def getKey(pre_key):
	key =[]
	for pk in pre_key:
		if pk == "A":
			key.append(1)
		elif pk == "C":
			key.append(2)
		elif pk == "G":
			key.append(3)
		else:
			key.append(4)
	return int("".join(map(str,key)))
		
	 getKey key =[] key [] for pk in pre_key:
		if pk == "A":
			key.append(1)
		elif pk == "C":
			key.append(2)
		elif pk == "G":
			key.append(3)
		else:
			key.append(4)
	 pk pre_key if pk == "A":
			key.append(1)
		elif pk == "C":
			key.append(2)
		elif pk == "G":
			key.append(3)
		else:
			key.append(4)
	 pk == "A" pk "A" key.append(1) key.append key append 1 elif pk == "C":
			key.append(2)
		 pk == "C" pk "C" key.append(2) key.append key append 2 elif pk == "G":
			key.append(3)
		 pk == "G" pk "G" key.append(3) key.append key append 3 key.append(4) key.append key append 4 return int("".join(map(str,key))) int("".join(map(str,key))) int "".join(map(str,key)) "".join "" join map(str,key) map str key pre_key pre_key def main():
	N = int(raw_input())
	cmd = [raw_input().split() for _ in range(N)]
	dic = [""] * ARRY_SIZE

	for i in range(N):
		if cmd[i][0] == "insert":
			insert(dic, getKey(cmd[i][1]))
		elif cmd[i][0] == "find":
			if find(dic, getKey(cmd[i][1])):
				print "yes"
			else:
				print "no"



#def test(): main N = int(raw_input()) N int(raw_input()) int raw_input() raw_input raw_input().split() for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) raw_input().split() ().split () raw_input split cmd = [raw_input().split() for _ in range(N)] cmd [raw_input().split() for _ in range(N)] dic = [""] * ARRY_SIZE dic [""] * ARRY_SIZE [""] "" ARRY_SIZE for i in range(N):
		if cmd[i][0] == "insert":
			insert(dic, getKey(cmd[i][1]))
		elif cmd[i][0] == "find":
			if find(dic, getKey(cmd[i][1])):
				print "yes"
			else:
				print "no"



#def test(): i range(N) range N if cmd[i][0] == "insert":
			insert(dic, getKey(cmd[i][1]))
		elif cmd[i][0] == "find":
			if find(dic, getKey(cmd[i][1])):
				print "yes"
			else:
				print "no"



#def test(): cmd[i][0] == "insert" cmd[i][0] [i] cmd i 0 "insert" insert(dic, getKey(cmd[i][1])) insert dic getKey(cmd[i][1]) getKey cmd[i][1] [i] cmd i 1 elif cmd[i][0] == "find":
			if find(dic, getKey(cmd[i][1])):
				print "yes"
			else:
				print "no"



#def test(): cmd[i][0] == "find" cmd[i][0] [i] cmd i 0 "find" if find(dic, getKey(cmd[i][1])):
				print "yes"
			else:
				print "no"



#def test(): find(dic, getKey(cmd[i][1])) find dic getKey(cmd[i][1]) getKey cmd[i][1] [i] cmd i 1 print print if __name__ == '__main__':
	main()
	#test() __name__ == '__main__' __name__ '__main__' main() main def hash_combo(key, i):
	return (hash1(key) + i * hash2(key)) % ARRY_SIZE def hash_combo(key, i):
	return (hash1(key) + i * hash2(key)) % ARRY_SIZE hash_combo def find(arr, key):
	i = 0
	while True:
		j = hash_combo(key,i)
		if arr[j] == key:
			return True
		elif arr[j] == "" or i >= ARRY_SIZE:
			return False
		else:
			i += 1 def find(arr, key):
	i = 0
	while True:
		j = hash_combo(key,i)
		if arr[j] == key:
			return True
		elif arr[j] == "" or i >= ARRY_SIZE:
			return False
		else:
			i += 1 find ARRY_SIZE = 1000003 1000003 ARRY_SIZE def hash1(key):
	return key % (ARRY_SIZE) def hash1(key):
	return key % (ARRY_SIZE) hash1 def main():
	N = int(raw_input())
	cmd = [raw_input().split() for _ in range(N)]
	dic = [""] * ARRY_SIZE

	for i in range(N):
		if cmd[i][0] == "insert":
			insert(dic, getKey(cmd[i][1]))
		elif cmd[i][0] == "find":
			if find(dic, getKey(cmd[i][1])):
				print "yes"
			else:
				print "no"



#def test(): def main():
	N = int(raw_input())
	cmd = [raw_input().split() for _ in range(N)]
	dic = [""] * ARRY_SIZE

	for i in range(N):
		if cmd[i][0] == "insert":
			insert(dic, getKey(cmd[i][1]))
		elif cmd[i][0] == "find":
			if find(dic, getKey(cmd[i][1])):
				print "yes"
			else:
				print "no"



#def test(): main def insert(arr,key):
	i = 0

	while True:
		j = hash_combo(key, i)
		if arr[j] == "":
			arr[j] = key
			return True
		else:
			i +=  1 def insert(arr,key):
	i = 0

	while True:
		j = hash_combo(key, i)
		if arr[j] == "":
			arr[j] = key
			return True
		else:
			i +=  1 insert def hash2(key):
	return 1 + (key % (ARRY_SIZE - 1)) def hash2(key):
	return 1 + (key % (ARRY_SIZE - 1)) hash2 def getKey(pre_key):
	key =[]
	for pk in pre_key:
		if pk == "A":
			key.append(1)
		elif pk == "C":
			key.append(2)
		elif pk == "G":
			key.append(3)
		else:
			key.append(4)
	return int("".join(map(str,key)))
		
	 def getKey(pre_key):
	key =[]
	for pk in pre_key:
		if pk == "A":
			key.append(1)
		elif pk == "C":
			key.append(2)
		elif pk == "G":
			key.append(3)
		else:
			key.append(4)
	return int("".join(map(str,key)))
		
	 getKey
#!/usr/bin/env python
#-*- coding:utf-8 -*-

ARRY_SIZE = 1000003

def hash1(key):
	return key % (ARRY_SIZE)

def hash2(key):
	return 1 + (key % (ARRY_SIZE - 1))

def hash_combo(key, i):
	return (hash1(key) + i * hash2(key)) % ARRY_SIZE

def insert(arr,key):
	i = 0

	while True:
		j = hash_combo(key, i)
		if arr[j] == "":
			arr[j] = key
			return True
		else:
			i +=  1

def find(arr, key):
	i = 0
	while True:
		j = hash_combo(key,i)
		if arr[j] == key:
			return True
		elif arr[j] == "" or i >= ARRY_SIZE:
			return False
		else:
			i += 1

def getKey(pre_key):
	key =[]
	for pk in pre_key:
		if pk == "A":
			key.append(1)
		elif pk == "C":
			key.append(2)
		elif pk == "G":
			key.append(3)
		else:
			key.append(4)
	return int("".join(map(str,key)))
		
	


def main():
	N = int(raw_input())
	cmd = [raw_input().split() for _ in range(N)]
	dic = [""] * ARRY_SIZE

	for i in range(N):
		if cmd[i][0] == "insert":
			insert(dic, getKey(cmd[i][1]))
		elif cmd[i][0] == "find":
			if find(dic, getKey(cmd[i][1])):
				print "yes"
			else:
				print "no"



#def test():

if __name__ == '__main__':
	main()
	#test()