import sys

M = 1044697
H = [None] * M

table = str.maketrans({"A":"1","C":"2","G":"3","T":"4"})


def getChar(ch):
    if ch == "A":
        return 1
    elif ch == "C":
        return 2
    elif ch == "G":
        return 3
    elif ch == "T":
        return 4
    else:
        return 0

def getKey(string):
    sum = 0
    p = 1
    for i in range(len(string)):
        sum += p*(getChar(string[i]))
        p *= 5
    return sum

#print(getKey(string))

def h1(key):
    return key % M

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

# 関数の中のwhile文はreturnで抜け出せる
def find(string):
    i = 0
    key = getKey(string)
    while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] == string:
            return 1
        elif H[h] is None:
            return 0
        else:
            i += 1

def insert(string):
    i = 0
    key = getKey(string)
    while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] is None:
            H[h] = string
            break
        else:
            i += 1


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

for _ in range(n):
    com,string = input().split()
    if com == "insert":
        insert(string)
    elif com == "find":
        if find(string):
            print("yes")
        else:
            print("no") import sys sys M = 1044697 M 1044697 H = [None] * M H [None] * M [None] None M table = str.maketrans({"A":"1","C":"2","G":"3","T":"4"}) table str.maketrans({"A":"1","C":"2","G":"3","T":"4"}) str.maketrans str maketrans {"A":"1","C":"2","G":"3","T":"4"} "A" "A" "1" "C" "C" "2" "G" "G" "3" "T" "T" "4" def getChar(ch):
    if ch == "A":
        return 1
    elif ch == "C":
        return 2
    elif ch == "G":
        return 3
    elif ch == "T":
        return 4
    else:
        return 0 getChar if ch == "A":
        return 1
    elif ch == "C":
        return 2
    elif ch == "G":
        return 3
    elif ch == "T":
        return 4
    else:
        return 0 ch == "A" ch "A" return 1 1 elif ch == "C":
        return 2
     ch == "C" ch "C" return 2 2 elif ch == "G":
        return 3
     ch == "G" ch "G" return 3 3 elif ch == "T":
        return 4
     ch == "T" ch "T" return 4 4 return 0 0 ch ch def getKey(string):
    sum = 0
    p = 1
    for i in range(len(string)):
        sum += p*(getChar(string[i]))
        p *= 5
    return sum

#print(getKey(string)) getKey sum = 0 sum 0 p = 1 p 1 for i in range(len(string)):
        sum += p*(getChar(string[i]))
        p *= 5
     i range(len(string)) range len(string) len string sum += p*(getChar(string[i])) sum p*(getChar(string[i])) p getChar(string[i]) getChar string[i] string i p *= 5 p 5 return sum sum string string def h1(key):
    return key % M h1 return key % M key % M key M key key def h2(key):
    return 1 + (key % (M-1))

# 関数の中のwhile文はreturnで抜け出せる h2 return 1 + (key % (M-1)) 1 + (key % (M-1)) 1 key % (M-1) key M-1 M 1 key key def find(string):
    i = 0
    key = getKey(string)
    while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] == string:
            return 1
        elif H[h] is None:
            return 0
        else:
            i += 1 find i = 0 i 0 key = getKey(string) key getKey(string) getKey string while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] == string:
            return 1
        elif H[h] is None:
            return 0
        else:
            i += 1 True h = (h1(key) + i * h2(key)) % M h (h1(key) + i * h2(key)) % M h1(key) + i * h2(key) h1(key) h1 key i * h2(key) i h2(key) h2 key M if H[h] == string:
            return 1
        elif H[h] is None:
            return 0
        else:
            i += 1 H[h] == string H[h] H h string return 1 1 elif H[h] is None:
            return 0
         H[h] is None H[h] H h None return 0 0 i += 1 i 1 string string def insert(string):
    i = 0
    key = getKey(string)
    while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] is None:
            H[h] = string
            break
        else:
            i += 1 insert i = 0 i 0 key = getKey(string) key getKey(string) getKey string while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] is None:
            H[h] = string
            break
        else:
            i += 1 True h = (h1(key) + i * h2(key)) % M h (h1(key) + i * h2(key)) % M h1(key) + i * h2(key) h1(key) h1 key i * h2(key) i h2(key) h2 key M if H[h] is None:
            H[h] = string
            break
        else:
            i += 1 H[h] is None H[h] H h None H[h] = string H[h] H h string break i += 1 i 1 string string input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline n = int(input()) n int(input()) int input() input for _ in range(n):
    com,string = input().split()
    if com == "insert":
        insert(string)
    elif com == "find":
        if find(string):
            print("yes")
        else:
            print("no") _ range(n) range n com,string = input().split() com input().split() ().split () input split string if com == "insert":
        insert(string)
    elif com == "find":
        if find(string):
            print("yes")
        else:
            print("no") com == "insert" com "insert" insert(string) insert string elif com == "find":
        if find(string):
            print("yes")
        else:
            print("no") com == "find" com "find" if find(string):
            print("yes")
        else:
            print("no") find(string) find string print("yes") print "yes" print("no") print "no" n = int(input()) int(input()) n def insert(string):
    i = 0
    key = getKey(string)
    while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] is None:
            H[h] = string
            break
        else:
            i += 1 def insert(string):
    i = 0
    key = getKey(string)
    while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] is None:
            H[h] = string
            break
        else:
            i += 1 insert def h2(key):
    return 1 + (key % (M-1))

# 関数の中のwhile文はreturnで抜け出せる def h2(key):
    return 1 + (key % (M-1))

# 関数の中のwhile文はreturnで抜け出せる h2 H = [None] * M [None] * M H M = 1044697 1044697 M com,string = input().split() input().split() com def h1(key):
    return key % M def h1(key):
    return key % M h1 def getChar(ch):
    if ch == "A":
        return 1
    elif ch == "C":
        return 2
    elif ch == "G":
        return 3
    elif ch == "T":
        return 4
    else:
        return 0 def getChar(ch):
    if ch == "A":
        return 1
    elif ch == "C":
        return 2
    elif ch == "G":
        return 3
    elif ch == "T":
        return 4
    else:
        return 0 getChar def getKey(string):
    sum = 0
    p = 1
    for i in range(len(string)):
        sum += p*(getChar(string[i]))
        p *= 5
    return sum

#print(getKey(string)) def getKey(string):
    sum = 0
    p = 1
    for i in range(len(string)):
        sum += p*(getChar(string[i]))
        p *= 5
    return sum

#print(getKey(string)) getKey input = sys.stdin.readline sys.stdin.readline input string = input().split() input().split() string table = str.maketrans({"A":"1","C":"2","G":"3","T":"4"}) str.maketrans({"A":"1","C":"2","G":"3","T":"4"}) table def find(string):
    i = 0
    key = getKey(string)
    while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] == string:
            return 1
        elif H[h] is None:
            return 0
        else:
            i += 1 def find(string):
    i = 0
    key = getKey(string)
    while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] == string:
            return 1
        elif H[h] is None:
            return 0
        else:
            i += 1 find
import sys

M = 1044697
H = [None] * M

table = str.maketrans({"A":"1","C":"2","G":"3","T":"4"})


def getChar(ch):
    if ch == "A":
        return 1
    elif ch == "C":
        return 2
    elif ch == "G":
        return 3
    elif ch == "T":
        return 4
    else:
        return 0

def getKey(string):
    sum = 0
    p = 1
    for i in range(len(string)):
        sum += p*(getChar(string[i]))
        p *= 5
    return sum

#print(getKey(string))

def h1(key):
    return key % M

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

# 関数の中のwhile文はreturnで抜け出せる
def find(string):
    i = 0
    key = getKey(string)
    while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] == string:
            return 1
        elif H[h] is None:
            return 0
        else:
            i += 1

def insert(string):
    i = 0
    key = getKey(string)
    while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] is None:
            H[h] = string
            break
        else:
            i += 1


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

for _ in range(n):
    com,string = input().split()
    if com == "insert":
        insert(string)
    elif com == "find":
        if find(string):
            print("yes")
        else:
            print("no")
