# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_C&lang=jp
sample_input = list(range(4))
sample_input[0] = '''6
insert AAA
insert AAC
find AAA
find CCC
insert CCC
find CCC'''
sample_input[1] = '''13
insert AAA
insert AAC
insert AGA
insert AGG
insert TTT
find AAA
find CCC
find CCC
insert CCC
find CCC
insert T
find TTT
find T'''
sample_input[2] = '''20
find CTT
find TAG
insert AA
insert CTC
find G
insert TGT
find AAC
find TTG
insert AA
insert TTG
insert G
insert A
insert GG
insert C
insert TT
find T
insert C
find GG
find G
insert CG'''
sample_input[3]='''15
insert AAA
insert AAC
insert AGA
insert AGG
insert TTT
find AAA
find CCC
find CCC
insert CCC
find CCC
find CC
insert T
find TTT
find T
find A'''
give_sample_input = None
if give_sample_input is not None:
    sample_input_list = sample_input[give_sample_input].split('\n')
    def input():
        return sample_input_list.pop(0)
        
# main
from collections import deque


def convert_ACGT_to_int(acgt_str):
        result = 0
        for char in acgt_str:
            result *= 5
            if char == 'A':
                result += 1
            elif char == 'C':
                result += 2
            elif char == 'G':
                result += 3
            elif char == 'T':
                result += 4
            else:
                assert False
        
        return result


def binary_search(increasing_list, elem):
    index_min = 0
    index_max = len(increasing_list) - 1
    
    while index_max - index_min >= 2:
        index_middle = int((index_min + index_max) / 2)
        if increasing_list[index_middle] == elem:
            return (True, index_middle + 1)
        elif increasing_list[index_middle] > elem:
            index_max = index_middle
        else:
            index_min = index_middle
            
    if index_max >= index_min:
        if increasing_list[index_max] == elem:
            return (True, index_max + 1)
        elif increasing_list[index_min] == elem:
            return (True, index_min + 1)
        elif increasing_list[index_max] < elem:
            return (False, index_max + 1)
        elif increasing_list[index_min] > elem:
            return (False, index_min)
        elif increasing_list[index_min] < increasing_list[index_max]:
            return (False, index_max)
        elif increasing_list[index_min] == increasing_list[index_max]:
            val = increasing_list[index_min]
            if elem < val:
                return (False, index_min)
            else:
                return (False, index_max + 1)
        else:
            assert False
                
                
    
    if index_max < index_min:
        return (False, None)


class Dict (object):
    
    def __init__(self):
        self.data = deque()
        pass
        
    def insert(self, item):
        index = binary_search(list(self.data), item)[1]
        if index is None:
            self.data.append(item)
        else:
            self.data.insert(index, item)
    
    def find(self, item):
        return binary_search(list(self.data), item)[0]


dict = Dict()
num_of_commands = int(input())
for n in range(num_of_commands):
    input_str = input()
    command, data = input_str.split(' ')
    if command == 'insert':
        dict.insert(convert_ACGT_to_int(data))
    else:
        if dict.find(convert_ACGT_to_int(data)):
            print('yes')
        else:
            print('no')
            

### FIXED CODE ###

# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_C&lang=jp
sample_input = list(range(4))
sample_input[0] = '''6
insert AAA
insert AAC
find AAA
find CCC
insert CCC
find CCC'''
sample_input[1] = '''13
insert AAA
insert AAC
insert AGA
insert AGG
insert TTT
find AAA
find CCC
find CCC
insert CCC
find CCC
insert T
find TTT
find T'''
sample_input[2] = '''20
find CTT
find TAG
insert AA
insert CTC
find G
insert TGT
find AAC
find TTG
insert AA
insert TTG
insert G
insert A
insert GG
insert C
insert TT
find T
insert C
find GG
find G
insert CG'''
sample_input[3]='''15
insert AAA
insert AAC
insert AGA
insert AGG
insert TTT
find AAA
find CCC
find CCC
insert CCC
find CCC
find CC
insert T
find TTT
find T
find A'''
give_sample_input = None
if give_sample_input is not None:
    sample_input_list = sample_input[give_sample_input].split('\n')
    def input():
        return sample_input_list.pop(0)
        
# main

class ACGTDictNode (object):
    
    def __init__(self):
        self.A = None    # None | ACGTDictNode
        self.C = None
        self.G = None
        self.T = None
        self.has_end = False
    
    
    def add_if_none(self, acgt):
        if acgt == 'A':
            if self.A is not None:
                return self.A
            else:
                self.A = ACGTDictNode()
                return self.A
        elif acgt == 'C':
            if self.C is not None:
                return self.C
            else:
                self.C = ACGTDictNode()
                return self.C
        elif acgt == 'G':
            if self.G is not None:
                return self.G
            else:
                self.G = ACGTDictNode()
                return self.G
        elif acgt == 'T':
            if self.T is not None:
                return self.T
            else:
                self.T = ACGTDictNode()
                return self.T
        else:
            assert False
            
            
    def get(self, acgt):
        if acgt == 'A':
            return self.A
        elif acgt == 'C':
            return self.C
        elif acgt == 'G':
            return self.G
        elif acgt == 'T':
            return self.T
        else:
            assert False
            
    
    def add_end(self):
        self.has_end = True

        

class ACGTDict (object):
    
    def __init__(self):
        self.tree = ACGTDictNode()
        
        
    def insert(self, string):
        node = self.tree
        for c in string:
            node = node.add_if_none(c)
        node.add_end()
            
    
    def find(self, string):
        node = self.tree
        for c in string:
            node = node.get(c)
            if node is None:
                return False
        return node.has_end
        
        

dict = ACGTDict()
num_of_commands = int(input())
for n in range(num_of_commands):
    input_str = input()
    command, data = input_str.split(' ')
    if command == 'insert':
        dict.insert(data)
    else:
        if dict.find(data):
            print('yes')
        else:
            print('no')