import sys 


class Tree:
    def __init__(self):
        self.children = {}
        self.end = False

    def __contains__(self, key):
        if len(key) == 0:
            return self.end

        k, *rest = key 
        if k not in self.children:
            return False

        return rest in self.children[k]

    def add(self, key):
        if len(key) > 0:
            k, *rest = key 
            if k not in self.children:
                self.children[k] = self.__class__()

            self.children[k].add(rest)
        else:
            self.end = True


class Dictionary:
    def __init__(self):
        self.tree = Tree()

    def insert(self, word):
        self.tree.add(word)

    def find(self, word):
        return word in self.tree


def run():
    _ = int(input())  # flake8: noqa
    words = Dictionary()

    for command in sys.stdin:

        if command.startswith('insert'):
            words.insert(command[7:])
        elif command.startswith('find'):
            if words.find(command[5:]):
                print('yes')
            else:
                print('no')
        else:
            raise ValueError()


if __name__ == '__main__':
    run()
 import sys sys class Tree:
    def __init__(self):
        self.children = {}
        self.end = False

    def __contains__(self, key):
        if len(key) == 0:
            return self.end

        k, *rest = key 
        if k not in self.children:
            return False

        return rest in self.children[k]

    def add(self, key):
        if len(key) > 0:
            k, *rest = key 
            if k not in self.children:
                self.children[k] = self.__class__()

            self.children[k].add(rest)
        else:
            self.end = True Tree def __init__(self):
        self.children = {}
        self.end = False

     __init__ self.children = {} self.children self children {} self.end = False self.end self end False self self def __contains__(self, key):
        if len(key) == 0:
            return self.end

        k, *rest = key 
        if k not in self.children:
            return False

        return rest in self.children[k]

     __contains__ if len(key) == 0:
            return self.end

         len(key) == 0 len(key) len key 0 return self.end self.end self end k, *rest = key k key *rest rest if k not in self.children:
            return False

         k not in self.children k self.children self children return False False return rest in self.children[k] rest in self.children[k] rest self.children[k] self.children self children k self self key key def add(self, key):
        if len(key) > 0:
            k, *rest = key 
            if k not in self.children:
                self.children[k] = self.__class__()

            self.children[k].add(rest)
        else:
            self.end = True add if len(key) > 0:
            k, *rest = key 
            if k not in self.children:
                self.children[k] = self.__class__()

            self.children[k].add(rest)
        else:
            self.end = True len(key) > 0 len(key) len key 0 k, *rest = key k key *rest rest if k not in self.children:
                self.children[k] = self.__class__()

             k not in self.children k self.children self children self.children[k] = self.__class__() self.children[k] self.children self children k self.__class__() self.__class__ self __class__ self.children[k].add(rest) self.children[k].add self.children[k] self.children self children k add rest self.end = True self.end self end True self self key key class Dictionary:
    def __init__(self):
        self.tree = Tree()

    def insert(self, word):
        self.tree.add(word)

    def find(self, word):
        return word in self.tree Dictionary def __init__(self):
        self.tree = Tree()

     __init__ self.tree = Tree() self.tree self tree Tree() Tree self self def insert(self, word):
        self.tree.add(word)

     insert self.tree.add(word) self.tree.add self.tree self tree add word self self word word def find(self, word):
        return word in self.tree find return word in self.tree word in self.tree word self.tree self tree self self word word def run():
    _ = int(input())  # flake8: noqa
    words = Dictionary()

    for command in sys.stdin:

        if command.startswith('insert'):
            words.insert(command[7:])
        elif command.startswith('find'):
            if words.find(command[5:]):
                print('yes')
            else:
                print('no')
        else:
            raise ValueError() run _ = int(input()) _ int(input()) int input() input words = Dictionary() words Dictionary() Dictionary for command in sys.stdin:

        if command.startswith('insert'):
            words.insert(command[7:])
        elif command.startswith('find'):
            if words.find(command[5:]):
                print('yes')
            else:
                print('no')
        else:
            raise ValueError() command sys.stdin sys stdin if command.startswith('insert'):
            words.insert(command[7:])
        elif command.startswith('find'):
            if words.find(command[5:]):
                print('yes')
            else:
                print('no')
        else:
            raise ValueError() command.startswith('insert') command.startswith command startswith 'insert' words.insert(command[7:]) words.insert words insert command[7:] command 7: 7 elif command.startswith('find'):
            if words.find(command[5:]):
                print('yes')
            else:
                print('no')
         command.startswith('find') command.startswith command startswith 'find' if words.find(command[5:]):
                print('yes')
            else:
                print('no')
         words.find(command[5:]) words.find words find command[5:] command 5: 5 print('yes') print 'yes' print('no') print 'no' raise ValueError() ValueError() ValueError if __name__ == '__main__':
    run() __name__ == '__main__' __name__ '__main__' run() run class Tree:
    def __init__(self):
        self.children = {}
        self.end = False

    def __contains__(self, key):
        if len(key) == 0:
            return self.end

        k, *rest = key 
        if k not in self.children:
            return False

        return rest in self.children[k]

    def add(self, key):
        if len(key) > 0:
            k, *rest = key 
            if k not in self.children:
                self.children[k] = self.__class__()

            self.children[k].add(rest)
        else:
            self.end = True class Tree:
    def __init__(self):
        self.children = {}
        self.end = False

    def __contains__(self, key):
        if len(key) == 0:
            return self.end

        k, *rest = key 
        if k not in self.children:
            return False

        return rest in self.children[k]

    def add(self, key):
        if len(key) > 0:
            k, *rest = key 
            if k not in self.children:
                self.children[k] = self.__class__()

            self.children[k].add(rest)
        else:
            self.end = True Tree class Dictionary:
    def __init__(self):
        self.tree = Tree()

    def insert(self, word):
        self.tree.add(word)

    def find(self, word):
        return word in self.tree class Dictionary:
    def __init__(self):
        self.tree = Tree()

    def insert(self, word):
        self.tree.add(word)

    def find(self, word):
        return word in self.tree Dictionary def run():
    _ = int(input())  # flake8: noqa
    words = Dictionary()

    for command in sys.stdin:

        if command.startswith('insert'):
            words.insert(command[7:])
        elif command.startswith('find'):
            if words.find(command[5:]):
                print('yes')
            else:
                print('no')
        else:
            raise ValueError() def run():
    _ = int(input())  # flake8: noqa
    words = Dictionary()

    for command in sys.stdin:

        if command.startswith('insert'):
            words.insert(command[7:])
        elif command.startswith('find'):
            if words.find(command[5:]):
                print('yes')
            else:
                print('no')
        else:
            raise ValueError() run
import sys 


class Tree:
    def __init__(self):
        self.children = {}
        self.end = False

    def __contains__(self, key):
        if len(key) == 0:
            return self.end

        k, *rest = key 
        if k not in self.children:
            return False

        return rest in self.children[k]

    def add(self, key):
        if len(key) > 0:
            k, *rest = key 
            if k not in self.children:
                self.children[k] = self.__class__()

            self.children[k].add(rest)
        else:
            self.end = True


class Dictionary:
    def __init__(self):
        self.tree = Tree()

    def insert(self, word):
        self.tree.add(word)

    def find(self, word):
        return word in self.tree


def run():
    _ = int(input())  # flake8: noqa
    words = Dictionary()

    for command in sys.stdin:

        if command.startswith('insert'):
            words.insert(command[7:])
        elif command.startswith('find'):
            if words.find(command[5:]):
                print('yes')
            else:
                print('no')
        else:
            raise ValueError()


if __name__ == '__main__':
    run()

