# AOJ ALDS1_4_C Dictionary

# Python3 2018.7.3 bal4u



dic = {}

n = int(eval(input()))

for i in range(n):

	id, s = input().split()

	if id == "insert": dic[s] = 1

	else: print(("yes" if s in dic else "no"))

# AOJ ALDS1_4_C Dictionary

# Python3 2018.7.3 bal4u



import sys

from sys import stdin

input = stdin.readline



dic = {}

n = int(eval(input()))

for i in range(n):

	s = eval(input())

	if s[0] == 'i': dic[s[7:]] = 1

	else: print(("yes" if s[5:] in dic else "no"))

# AOJ ALDS1_4_C Dictionary
# Python3 2018.7.3 bal4u
dic = {}
n = int(eval(input()))
for i in range(n):
    id, s = input().split()
    if id == "insert":
        dic[s] = 1
    else:
        print(("yes" if s in dic else "no"))

# AOJ ALDS1_4_C Dictionary
# Python3 2018.7.3 bal4u
import sys
from sys import stdin

input = stdin.readline
dic = {}
n = int(eval(input()))
for i in range(n):
    s = eval(input())
    if s[0] == "i":
        dic[s[7:]] = 1
    else:
        print(("yes" if s[5:] in dic else "no"))

+import sys +from sys import stdin + +input = stdin.readline -    id, s = input().split() -    if id == "insert": -        dic[s] = 1 +    s = eval(input()) +    if s[0] == "i": +        dic[s[7:]] = 1 -        print(("yes" if s in dic else "no")) +        print(("yes" if s[5:] in dic else "no"))