import sys

M = 1046527
def h1(key):
    return key % M

def h2(key):
    return 1 + (key %(M-1))

def h3(key, i):
    return (h1(key) + i*h2(key)) % M

word_dic = {'A': 1, 'T': 2, 'G': 3, 'C': 4}
def getkey(text):
    sum = 0
    p = 1
    for c in text:
        sum += p*word_dic[c]
        p *= 5
    return sum

dict = [None for i in range(M)]
def find(text):
    key = getkey(text)
    i = 0
    while i < M:
        h = h3(key, i)
        if dict[h] == None:
            break
        elif dict[h] == text:
            return True
        i += 1
    return False

def insert(text):

    key = getkey(text)
    i = 0
    while i < M:
        j = h3(key, i)
        if dict[j] == None:
            dict[j] = text
            break
        else:
            i += 1

n = int(input())
operations = sys.stdin.readlines()
for ope in operations:
    op, text = ope.rstrip().split(' ')
    if op == 'insert':
        insert(text)
    elif op == 'find':
        rst = find(text)
        if rst:
            print('yes')
        else:
            print('no')
 import sys sys M = 1046527 M 1046527 def h1(key):
    return key % M h1 return key % M key % M key M key key def h2(key):
    return 1 + (key %(M-1)) h2 return 1 + (key %(M-1)) 1 + (key %(M-1)) 1 key %(M-1) key M-1 M 1 key key def h3(key, i):
    return (h1(key) + i*h2(key)) % M h3 return (h1(key) + i*h2(key)) % M (h1(key) + i*h2(key)) % M h1(key) + i*h2(key) h1(key) h1 key i*h2(key) i h2(key) h2 key M key key i i word_dic = {'A': 1, 'T': 2, 'G': 3, 'C': 4} word_dic {'A': 1, 'T': 2, 'G': 3, 'C': 4} 'A' 'A' 1 'T' 'T' 2 'G' 'G' 3 'C' 'C' 4 def getkey(text):
    sum = 0
    p = 1
    for c in text:
        sum += p*word_dic[c]
        p *= 5
    return sum getkey sum = 0 sum 0 p = 1 p 1 for c in text:
        sum += p*word_dic[c]
        p *= 5
     c text sum += p*word_dic[c] sum p*word_dic[c] p word_dic[c] word_dic c p *= 5 p 5 return sum sum text text None for i in range(M) for i in range(M) i range(M) range M for i in range(M) None dict = [None for i in range(M)] dict [None for i in range(M)] def find(text):
    key = getkey(text)
    i = 0
    while i < M:
        h = h3(key, i)
        if dict[h] == None:
            break
        elif dict[h] == text:
            return True
        i += 1
    return False find key = getkey(text) key getkey(text) getkey text i = 0 i 0 while i < M:
        h = h3(key, i)
        if dict[h] == None:
            break
        elif dict[h] == text:
            return True
        i += 1
     i < M i M h = h3(key, i) h h3(key, i) h3 key i if dict[h] == None:
            break
        elif dict[h] == text:
            return True
         dict[h] == None dict[h] dict h None break elif dict[h] == text:
            return True
         dict[h] == text dict[h] dict h text return True True i += 1 i 1 return False False text text def insert(text):

    key = getkey(text)
    i = 0
    while i < M:
        j = h3(key, i)
        if dict[j] == None:
            dict[j] = text
            break
        else:
            i += 1 insert key = getkey(text) key getkey(text) getkey text i = 0 i 0 while i < M:
        j = h3(key, i)
        if dict[j] == None:
            dict[j] = text
            break
        else:
            i += 1 i < M i M j = h3(key, i) j h3(key, i) h3 key i if dict[j] == None:
            dict[j] = text
            break
        else:
            i += 1 dict[j] == None dict[j] dict j None dict[j] = text dict[j] dict j text break i += 1 i 1 text text n = int(input()) n int(input()) int input() input operations = sys.stdin.readlines() operations sys.stdin.readlines() sys.stdin.readlines sys.stdin sys stdin readlines for ope in operations:
    op, text = ope.rstrip().split(' ')
    if op == 'insert':
        insert(text)
    elif op == 'find':
        rst = find(text)
        if rst:
            print('yes')
        else:
            print('no') ope operations op, text = ope.rstrip().split(' ') op ope.rstrip().split(' ') ope.rstrip().split ope.rstrip() ope.rstrip ope rstrip split ' ' text if op == 'insert':
        insert(text)
    elif op == 'find':
        rst = find(text)
        if rst:
            print('yes')
        else:
            print('no') op == 'insert' op 'insert' insert(text) insert text elif op == 'find':
        rst = find(text)
        if rst:
            print('yes')
        else:
            print('no') op == 'find' op 'find' rst = find(text) rst find(text) find text if rst:
            print('yes')
        else:
            print('no') rst print('yes') print 'yes' print('no') print 'no' def h1(key):
    return key % M def h1(key):
    return key % M h1 operations = sys.stdin.readlines() sys.stdin.readlines() operations M = 1046527 1046527 M rst = find(text) find(text) rst def h3(key, i):
    return (h1(key) + i*h2(key)) % M def h3(key, i):
    return (h1(key) + i*h2(key)) % M h3 def find(text):
    key = getkey(text)
    i = 0
    while i < M:
        h = h3(key, i)
        if dict[h] == None:
            break
        elif dict[h] == text:
            return True
        i += 1
    return False def find(text):
    key = getkey(text)
    i = 0
    while i < M:
        h = h3(key, i)
        if dict[h] == None:
            break
        elif dict[h] == text:
            return True
        i += 1
    return False find op, text = ope.rstrip().split(' ') ope.rstrip().split(' ') op def insert(text):

    key = getkey(text)
    i = 0
    while i < M:
        j = h3(key, i)
        if dict[j] == None:
            dict[j] = text
            break
        else:
            i += 1 def insert(text):

    key = getkey(text)
    i = 0
    while i < M:
        j = h3(key, i)
        if dict[j] == None:
            dict[j] = text
            break
        else:
            i += 1 insert def h2(key):
    return 1 + (key %(M-1)) def h2(key):
    return 1 + (key %(M-1)) h2 dict = [None for i in range(M)] [None for i in range(M)] dict n = int(input()) int(input()) n def getkey(text):
    sum = 0
    p = 1
    for c in text:
        sum += p*word_dic[c]
        p *= 5
    return sum def getkey(text):
    sum = 0
    p = 1
    for c in text:
        sum += p*word_dic[c]
        p *= 5
    return sum getkey word_dic = {'A': 1, 'T': 2, 'G': 3, 'C': 4} {'A': 1, 'T': 2, 'G': 3, 'C': 4} word_dic text = ope.rstrip().split(' ') ope.rstrip().split(' ') text
import sys

M = 1046527
def h1(key):
    return key % M

def h2(key):
    return 1 + (key %(M-1))

def h3(key, i):
    return (h1(key) + i*h2(key)) % M

word_dic = {'A': 1, 'T': 2, 'G': 3, 'C': 4}
def getkey(text):
    sum = 0
    p = 1
    for c in text:
        sum += p*word_dic[c]
        p *= 5
    return sum

dict = [None for i in range(M)]
def find(text):
    key = getkey(text)
    i = 0
    while i < M:
        h = h3(key, i)
        if dict[h] == None:
            break
        elif dict[h] == text:
            return True
        i += 1
    return False

def insert(text):

    key = getkey(text)
    i = 0
    while i < M:
        j = h3(key, i)
        if dict[j] == None:
            dict[j] = text
            break
        else:
            i += 1

n = int(input())
operations = sys.stdin.readlines()
for ope in operations:
    op, text = ope.rstrip().split(' ')
    if op == 'insert':
        insert(text)
    elif op == 'find':
        rst = find(text)
        if rst:
            print('yes')
        else:
            print('no')

