class Dic:
    def __init__(self):
        self.end = False
        self.a = self.c = self.g = self.t = 0
    def insert(self, s):
        node = self
        index = 0
        while index < len(s):
            c = s[index]
            child = 0
            if c == 'A':
                if not node.a:
                    node.a = Dic()
                child = node.a
            elif c == 'C':
                if not node.c:
                    node.c = Dic()
                child = node.c
            elif c == 'G':
                if not node.g:
                    node.g = Dic()
                child = node.g
            elif c == 'T':
                if not node.t:
                    node.t = Dic()
                child = node.t
            else:
                return
            node = child
            index += 1
        node.end = True
    def find(self, s):
        node = self
        index = 0
        while index < len(s):
            c = s[index]
            child = 0
            if c == 'A':
                child = node.a
            elif c == 'C':
                child = node.c
            elif c == 'G':
                child = node.g
            elif c == 'T':
                child = node.t
            if child == 0:
                return False
            node = child
            index += 1
        return node.end

dic = Dic()

n = int(input())
for _ in range(n):
    cmd = list(input().split())
    if cmd[0] == 'insert':
        dic.insert(cmd[1])
    elif cmd[0] == 'find':
        print('yes' if dic.find(cmd[1]) else 'no')
 class Dic:
    def __init__(self):
        self.end = False
        self.a = self.c = self.g = self.t = 0
    def insert(self, s):
        node = self
        index = 0
        while index < len(s):
            c = s[index]
            child = 0
            if c == 'A':
                if not node.a:
                    node.a = Dic()
                child = node.a
            elif c == 'C':
                if not node.c:
                    node.c = Dic()
                child = node.c
            elif c == 'G':
                if not node.g:
                    node.g = Dic()
                child = node.g
            elif c == 'T':
                if not node.t:
                    node.t = Dic()
                child = node.t
            else:
                return
            node = child
            index += 1
        node.end = True
    def find(self, s):
        node = self
        index = 0
        while index < len(s):
            c = s[index]
            child = 0
            if c == 'A':
                child = node.a
            elif c == 'C':
                child = node.c
            elif c == 'G':
                child = node.g
            elif c == 'T':
                child = node.t
            if child == 0:
                return False
            node = child
            index += 1
        return node.end Dic def __init__(self):
        self.end = False
        self.a = self.c = self.g = self.t = 0
     __init__ self.end = False self.end self end False self.a = self.c = self.g = self.t = 0 self.a self a 0 = self.c = self.g = self.t = 0 self.c self c 0 self.g self g self.t self t self self def insert(self, s):
        node = self
        index = 0
        while index < len(s):
            c = s[index]
            child = 0
            if c == 'A':
                if not node.a:
                    node.a = Dic()
                child = node.a
            elif c == 'C':
                if not node.c:
                    node.c = Dic()
                child = node.c
            elif c == 'G':
                if not node.g:
                    node.g = Dic()
                child = node.g
            elif c == 'T':
                if not node.t:
                    node.t = Dic()
                child = node.t
            else:
                return
            node = child
            index += 1
        node.end = True
     insert node = self node self index = 0 index 0 while index < len(s):
            c = s[index]
            child = 0
            if c == 'A':
                if not node.a:
                    node.a = Dic()
                child = node.a
            elif c == 'C':
                if not node.c:
                    node.c = Dic()
                child = node.c
            elif c == 'G':
                if not node.g:
                    node.g = Dic()
                child = node.g
            elif c == 'T':
                if not node.t:
                    node.t = Dic()
                child = node.t
            else:
                return
            node = child
            index += 1
         index < len(s) index len(s) len s c = s[index] c s[index] s index child = 0 child 0 if c == 'A':
                if not node.a:
                    node.a = Dic()
                child = node.a
            elif c == 'C':
                if not node.c:
                    node.c = Dic()
                child = node.c
            elif c == 'G':
                if not node.g:
                    node.g = Dic()
                child = node.g
            elif c == 'T':
                if not node.t:
                    node.t = Dic()
                child = node.t
            else:
                return
             c == 'A' c 'A' if not node.a:
                    node.a = Dic()
                 not node.a node.a node a node.a = Dic() node.a node a Dic() Dic child = node.a child node.a node a elif c == 'C':
                if not node.c:
                    node.c = Dic()
                child = node.c
             c == 'C' c 'C' if not node.c:
                    node.c = Dic()
                 not node.c node.c node c node.c = Dic() node.c node c Dic() Dic child = node.c child node.c node c elif c == 'G':
                if not node.g:
                    node.g = Dic()
                child = node.g
             c == 'G' c 'G' if not node.g:
                    node.g = Dic()
                 not node.g node.g node g node.g = Dic() node.g node g Dic() Dic child = node.g child node.g node g elif c == 'T':
                if not node.t:
                    node.t = Dic()
                child = node.t
             c == 'T' c 'T' if not node.t:
                    node.t = Dic()
                 not node.t node.t node t node.t = Dic() node.t node t Dic() Dic child = node.t child node.t node t return node = child node child index += 1 index 1 node.end = True node.end node end True self self s s def find(self, s):
        node = self
        index = 0
        while index < len(s):
            c = s[index]
            child = 0
            if c == 'A':
                child = node.a
            elif c == 'C':
                child = node.c
            elif c == 'G':
                child = node.g
            elif c == 'T':
                child = node.t
            if child == 0:
                return False
            node = child
            index += 1
        return node.end find node = self node self index = 0 index 0 while index < len(s):
            c = s[index]
            child = 0
            if c == 'A':
                child = node.a
            elif c == 'C':
                child = node.c
            elif c == 'G':
                child = node.g
            elif c == 'T':
                child = node.t
            if child == 0:
                return False
            node = child
            index += 1
         index < len(s) index len(s) len s c = s[index] c s[index] s index child = 0 child 0 if c == 'A':
                child = node.a
            elif c == 'C':
                child = node.c
            elif c == 'G':
                child = node.g
            elif c == 'T':
                child = node.t
             c == 'A' c 'A' child = node.a child node.a node a elif c == 'C':
                child = node.c
             c == 'C' c 'C' child = node.c child node.c node c elif c == 'G':
                child = node.g
             c == 'G' c 'G' child = node.g child node.g node g elif c == 'T':
                child = node.t
             c == 'T' c 'T' child = node.t child node.t node t if child == 0:
                return False
             child == 0 child 0 return False False node = child node child index += 1 index 1 return node.end node.end node end self self s s dic = Dic() dic Dic() Dic n = int(input()) n int(input()) int input() input for _ in range(n):
    cmd = list(input().split())
    if cmd[0] == 'insert':
        dic.insert(cmd[1])
    elif cmd[0] == 'find':
        print('yes' if dic.find(cmd[1]) else 'no') _ range(n) range n cmd = list(input().split()) cmd list(input().split()) list input().split() ().split () input split if cmd[0] == 'insert':
        dic.insert(cmd[1])
    elif cmd[0] == 'find':
        print('yes' if dic.find(cmd[1]) else 'no') cmd[0] == 'insert' cmd[0] cmd 0 'insert' dic.insert(cmd[1]) dic.insert dic insert cmd[1] cmd 1 elif cmd[0] == 'find':
        print('yes' if dic.find(cmd[1]) else 'no') cmd[0] == 'find' cmd[0] cmd 0 'find' print('yes' if dic.find(cmd[1]) else 'no') print 'yes' if dic.find(cmd[1]) else 'no' dic.find(cmd[1]) dic.find dic find cmd[1] cmd 1 'yes' 'no' class Dic:
    def __init__(self):
        self.end = False
        self.a = self.c = self.g = self.t = 0
    def insert(self, s):
        node = self
        index = 0
        while index < len(s):
            c = s[index]
            child = 0
            if c == 'A':
                if not node.a:
                    node.a = Dic()
                child = node.a
            elif c == 'C':
                if not node.c:
                    node.c = Dic()
                child = node.c
            elif c == 'G':
                if not node.g:
                    node.g = Dic()
                child = node.g
            elif c == 'T':
                if not node.t:
                    node.t = Dic()
                child = node.t
            else:
                return
            node = child
            index += 1
        node.end = True
    def find(self, s):
        node = self
        index = 0
        while index < len(s):
            c = s[index]
            child = 0
            if c == 'A':
                child = node.a
            elif c == 'C':
                child = node.c
            elif c == 'G':
                child = node.g
            elif c == 'T':
                child = node.t
            if child == 0:
                return False
            node = child
            index += 1
        return node.end class Dic:
    def __init__(self):
        self.end = False
        self.a = self.c = self.g = self.t = 0
    def insert(self, s):
        node = self
        index = 0
        while index < len(s):
            c = s[index]
            child = 0
            if c == 'A':
                if not node.a:
                    node.a = Dic()
                child = node.a
            elif c == 'C':
                if not node.c:
                    node.c = Dic()
                child = node.c
            elif c == 'G':
                if not node.g:
                    node.g = Dic()
                child = node.g
            elif c == 'T':
                if not node.t:
                    node.t = Dic()
                child = node.t
            else:
                return
            node = child
            index += 1
        node.end = True
    def find(self, s):
        node = self
        index = 0
        while index < len(s):
            c = s[index]
            child = 0
            if c == 'A':
                child = node.a
            elif c == 'C':
                child = node.c
            elif c == 'G':
                child = node.g
            elif c == 'T':
                child = node.t
            if child == 0:
                return False
            node = child
            index += 1
        return node.end Dic cmd = list(input().split()) list(input().split()) cmd n = int(input()) int(input()) n dic = Dic() Dic() dic
class Dic:
    def __init__(self):
        self.end = False
        self.a = self.c = self.g = self.t = 0
    def insert(self, s):
        node = self
        index = 0
        while index < len(s):
            c = s[index]
            child = 0
            if c == 'A':
                if not node.a:
                    node.a = Dic()
                child = node.a
            elif c == 'C':
                if not node.c:
                    node.c = Dic()
                child = node.c
            elif c == 'G':
                if not node.g:
                    node.g = Dic()
                child = node.g
            elif c == 'T':
                if not node.t:
                    node.t = Dic()
                child = node.t
            else:
                return
            node = child
            index += 1
        node.end = True
    def find(self, s):
        node = self
        index = 0
        while index < len(s):
            c = s[index]
            child = 0
            if c == 'A':
                child = node.a
            elif c == 'C':
                child = node.c
            elif c == 'G':
                child = node.g
            elif c == 'T':
                child = node.t
            if child == 0:
                return False
            node = child
            index += 1
        return node.end

dic = Dic()

n = int(input())
for _ in range(n):
    cmd = list(input().split())
    if cmd[0] == 'insert':
        dic.insert(cmd[1])
    elif cmd[0] == 'find':
        print('yes' if dic.find(cmd[1]) else 'no')

