N = int(eval(input()))

d = {}

for i in [None]*N:

    a, b = input().split()

    if a == "insert":

        d[b] = 1

    else:

        print(("yes" if b in d else "no"))
class Dictionary(object):

    def __init__(self, size):

        self.size = size

        self.a = [None]*size



    def hash(self, x):

        key = hash(x) % self.size

        while self.a[key] and self.a[key] != x:

            key = (key + 10**9+7) % self.size

        return key



    def insert(self, x):

        self.a[self.hash(x)] = x



    def find(self, x):

        return self.a[self.hash(x)] is not None





if __name__ == "__main__":

    import sys

    n = int(input())

    dictionary = Dictionary(n)

    result = []

    for command, s in (l.split() for l in sys.stdin):

        if command == "insert":

            dictionary.insert(s)

        else:

            result.append("yes" if dictionary.find(s) else "no")



    print(*result, sep="\n")

N = int(eval(input()))
d = {}
for i in [None] * N:
    a, b = input().split()
    if a == "insert":
        d[b] = 1
    else:
        print(("yes" if b in d else "no"))

class Dictionary(object):
    def __init__(self, size):
        self.size = size
        self.a = [None] * size

    def hash(self, x):
        key = hash(x) % self.size
        while self.a[key] and self.a[key] != x:
            key = (key + 10**9 + 7) % self.size
        return key

    def insert(self, x):
        self.a[self.hash(x)] = x

    def find(self, x):
        return self.a[self.hash(x)] is not None


if __name__ == "__main__":
    import sys

    n = int(input())
    dictionary = Dictionary(n)
    result = []
    for command, s in (l.split() for l in sys.stdin):
        if command == "insert":
            dictionary.insert(s)
        else:
            result.append("yes" if dictionary.find(s) else "no")
    print(*result, sep="\n")

-N = int(eval(input())) -d = {} -for i in [None] * N: -    a, b = input().split() -    if a == "insert": -        d[b] = 1 -    else: -        print(("yes" if b in d else "no")) +class Dictionary(object): +    def __init__(self, size): +        self.size = size +        self.a = [None] * size + +    def hash(self, x): +        key = hash(x) % self.size +        while self.a[key] and self.a[key] != x: +            key = (key + 10**9 + 7) % self.size +        return key + +    def insert(self, x): +        self.a[self.hash(x)] = x + +    def find(self, x): +        return self.a[self.hash(x)] is not None + + +if __name__ == "__main__": +    import sys + +    n = int(input()) +    dictionary = Dictionary(n) +    result = [] +    for command, s in (l.split() for l in sys.stdin): +        if command == "insert": +            dictionary.insert(s) +        else: +            result.append("yes" if dictionary.find(s) else "no") +    print(*result, sep="\n")