### BUGGY CODE ###

# -*- coding:utf-8 -*-
import sys


class Cell(object):
    __slots__ = ["value", "pre", "next"]

    def __init__(self, value=None, pre=None, _next=None):
        self.value = value
        if pre is None and _next is None:
            self.pre = self
            self.next = self
        else:
            self.pre = pre
            self.next = _next


class DoublyLinkedList(object):
    def __init__(self):
        self._nil = Cell()

    def insert(self, value):
        self._nil.next = Cell(value, self._nil, self._nil.next)
        self._nil.next.next.pre = self._nil.next

    def toList(self):
        gen = self._val_generator()
        return [val for val in gen()]

    def _val_generator(self):
        def gen():
            current = self._nil.next
            while current is not self._nil:
                yield current.value
                current = current.next
        return gen

    def find(self, value):
        current = self._nil.next
        while current is not self._nil and current.value != value:
            current = current.next
        if current is self._nil:
            return False
        else:
            return True


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

    def _hash(self, i):
        return i % self.size

    def insert(self, i, value):
        _hash = self._hash(i)
        if self.array[_hash] is None:
            self.array[_hash] = DoublyLinkedList()
        self.array[_hash].insert(value)

    def find(self, i, value):
        _hash = self._hash(i)
        if self.array[_hash] is None:
            return False
        else:
            return self.array[_hash].find(value)


def ctoi(c):
    if c == "A":
        return 1
    elif c == "C":
        return 2
    elif c == "G":
        return 3
    elif c == "T":
        return 4


def stoi(s):
    ret = 0
    for i, c in enumerate(s, 1):
        ret += ctoi(c) * i
    return ret


def dictionary(lst):
    h = Hash(100)
    for val in lst:
        if val[0] == "insert":
            h.insert(stoi(val[1]), val[1])
        elif val[0] == "find":
            if h.find(stoi(val[1]), val[1]):
                print("yes")
            else:
                print("no")
        else:
            raise ValueError


if __name__ == "__main__":
    lst = [val.split() for val in sys.stdin.read().splitlines()]
    lst.pop(0)
    dictionary(lst)

### FIXED CODE ###

# -*- coding:utf-8 -*-
import sys


class Hash(object):
    def __init__(self, size):
        self._array = [None] * size
        self._size = size

    def _hash(self, key):
        return key % self._size

    def insert(self, key, value):
        j = self._hash(key)
        if self._array[j] is None:
            self._array[j] = [value]
        else:
            self._array[j].append(value)

    def find(self, key, value):
        j = self._hash(key)
        if self._array[j] is None:
            return False
        elif value in self._array[j]:
            return True
        else:
            return False


def stoi(s):
    ret = 0
    p = 1
    ctoi = {"A": 1, "C": 2, "G": 3, "T": 4}
    for c in s:
        ret += ctoi[c] * p
        p *= 7
    return ret


def dictionary(lst):
    h = Hash(1046527)
    ret = []
    for val in lst:
        if val[0] == "insert":
            h.insert(stoi(val[1]), val[1])
        elif val[0] == "find":
            if h.find(stoi(val[1]), val[1]):
                ret.append("yes")
            else:
                ret.append("no")
        else:
            raise ValueError
    return ret


if __name__ == "__main__":
    lst = [val.split() for val in sys.stdin.read().splitlines()]
    n = int(lst.pop(0)[0])
    print("\n".join(dictionary(lst)))