import sys

def h1(key):
    return key % M

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

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

def my_insert(dic, key):
    i = 0

    while 1:
        j = H(key, i)
        if dic[j] is None:
            dic[j] = key
            return j
        else:
            i += 1

def my_search(dic, key):
    i = 0

    while 1:
        j = H(key, i)
        if dic[j] == key:
            return True
        elif dic[j] is None or i >= M:
            return False
        else:
            i += 1

def str2int(s):
    res = s

    res = res.replace("A", "1")
    res = res.replace("C", "2")
    res = res.replace("G", "3")
    res = res.replace("T", "4")

    return int(res)

M = 1000003
dic = [None] * M

n = int(sys.stdin.readline())

for k in range(n):
    cmd, s = sys.stdin.readline().split()

    if cmd == "insert":
        my_insert(dic, str2int(s))
    else:
        print("yes" if my_search(dic, str2int(s)) else "no") import sys sys 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 H(key, i):
    return (h1(key) + i * h2(key)) % M H 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 def my_insert(dic, key):
    i = 0

    while 1:
        j = H(key, i)
        if dic[j] is None:
            dic[j] = key
            return j
        else:
            i += 1 my_insert i = 0 i 0 while 1:
        j = H(key, i)
        if dic[j] is None:
            dic[j] = key
            return j
        else:
            i += 1 1 j = H(key, i) j H(key, i) H key i if dic[j] is None:
            dic[j] = key
            return j
        else:
            i += 1 dic[j] is None dic[j] dic j None dic[j] = key dic[j] dic j key return j j i += 1 i 1 dic dic key key def my_search(dic, key):
    i = 0

    while 1:
        j = H(key, i)
        if dic[j] == key:
            return True
        elif dic[j] is None or i >= M:
            return False
        else:
            i += 1 my_search i = 0 i 0 while 1:
        j = H(key, i)
        if dic[j] == key:
            return True
        elif dic[j] is None or i >= M:
            return False
        else:
            i += 1 1 j = H(key, i) j H(key, i) H key i if dic[j] == key:
            return True
        elif dic[j] is None or i >= M:
            return False
        else:
            i += 1 dic[j] == key dic[j] dic j key return True True elif dic[j] is None or i >= M:
            return False
         dic[j] is None or i >= M dic[j] is None dic[j] dic j None i >= M i M return False False i += 1 i 1 dic dic key key def str2int(s):
    res = s

    res = res.replace("A", "1")
    res = res.replace("C", "2")
    res = res.replace("G", "3")
    res = res.replace("T", "4")

    return int(res) str2int res = s res s res = res.replace("A", "1") res res.replace("A", "1") res.replace res replace "A" "1" res = res.replace("C", "2") res res.replace("C", "2") res.replace res replace "C" "2" res = res.replace("G", "3") res res.replace("G", "3") res.replace res replace "G" "3" res = res.replace("T", "4") res res.replace("T", "4") res.replace res replace "T" "4" return int(res) int(res) int res s s M = 1000003 M 1000003 dic = [None] * M dic [None] * M [None] None M n = int(sys.stdin.readline()) n int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline for k in range(n):
    cmd, s = sys.stdin.readline().split()

    if cmd == "insert":
        my_insert(dic, str2int(s))
    else:
        print("yes" if my_search(dic, str2int(s)) else "no") k range(n) range n cmd, s = sys.stdin.readline().split() cmd sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split s if cmd == "insert":
        my_insert(dic, str2int(s))
    else:
        print("yes" if my_search(dic, str2int(s)) else "no") cmd == "insert" cmd "insert" my_insert(dic, str2int(s)) my_insert dic str2int(s) str2int s print("yes" if my_search(dic, str2int(s)) else "no") print "yes" if my_search(dic, str2int(s)) else "no" my_search(dic, str2int(s)) my_search dic str2int(s) str2int s "yes" "no" def h1(key):
    return key % M def h1(key):
    return key % M h1 M = 1000003 1000003 M def my_search(dic, key):
    i = 0

    while 1:
        j = H(key, i)
        if dic[j] == key:
            return True
        elif dic[j] is None or i >= M:
            return False
        else:
            i += 1 def my_search(dic, key):
    i = 0

    while 1:
        j = H(key, i)
        if dic[j] == key:
            return True
        elif dic[j] is None or i >= M:
            return False
        else:
            i += 1 my_search s = sys.stdin.readline().split() sys.stdin.readline().split() s def my_insert(dic, key):
    i = 0

    while 1:
        j = H(key, i)
        if dic[j] is None:
            dic[j] = key
            return j
        else:
            i += 1 def my_insert(dic, key):
    i = 0

    while 1:
        j = H(key, i)
        if dic[j] is None:
            dic[j] = key
            return j
        else:
            i += 1 my_insert cmd, s = sys.stdin.readline().split() sys.stdin.readline().split() cmd def H(key, i):
    return (h1(key) + i * h2(key)) % M def H(key, i):
    return (h1(key) + i * h2(key)) % M H def h2(key):
    return 1 + key % (M - 1) def h2(key):
    return 1 + key % (M - 1) h2 n = int(sys.stdin.readline()) int(sys.stdin.readline()) n def str2int(s):
    res = s

    res = res.replace("A", "1")
    res = res.replace("C", "2")
    res = res.replace("G", "3")
    res = res.replace("T", "4")

    return int(res) def str2int(s):
    res = s

    res = res.replace("A", "1")
    res = res.replace("C", "2")
    res = res.replace("G", "3")
    res = res.replace("T", "4")

    return int(res) str2int dic = [None] * M [None] * M dic
import sys

def h1(key):
    return key % M

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

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

def my_insert(dic, key):
    i = 0

    while 1:
        j = H(key, i)
        if dic[j] is None:
            dic[j] = key
            return j
        else:
            i += 1

def my_search(dic, key):
    i = 0

    while 1:
        j = H(key, i)
        if dic[j] == key:
            return True
        elif dic[j] is None or i >= M:
            return False
        else:
            i += 1

def str2int(s):
    res = s

    res = res.replace("A", "1")
    res = res.replace("C", "2")
    res = res.replace("G", "3")
    res = res.replace("T", "4")

    return int(res)

M = 1000003
dic = [None] * M

n = int(sys.stdin.readline())

for k in range(n):
    cmd, s = sys.stdin.readline().split()

    if cmd == "insert":
        my_insert(dic, str2int(s))
    else:
        print("yes" if my_search(dic, str2int(s)) else "no")