M = 1046527
POW = [pow(4, i) for i in range(13)]


def insert(dic, string):
    # i = 0
    # while dic[(hash1(string) + i*hash2(string)) % M]:
    #     i += 1
    # dic[(hash1(string) + i*hash2(string)) % M] = string
    dic[get_key(string)] = string


def find(dic, string):
    # i = 0
    # while dic[(hash1(string) + i*hash2(string)) % M] and dic[(hash1(string) + i*hash2(string)) % M] != string:
    #     i += 1
    # return True if dic[(hash1(string) + i*hash2(string)) % M] == string else False
    # print(dic[get_key(string)], string)
    return True if dic[get_key(string)] == string else False


def get_num(char):
    if char == "A":
        return 1
    elif char == "C":
        return 2
    elif char == "G":
        return 3
    else:
        return 4


def get_key(string):
    num = 0
    for i in range(len(string)):
        num += POW[i] * get_num(string[i])
    return num


def main():
    n = int(input())
    dic = [None] * POW[12]
    # print(dic)
    for i in range(n):
        order, string = input().split()
        if order == "insert":
            insert(dic, string)
        else:
            if find(dic, string):
                print('yes')
            else:
                print('no')


if __name__ == "__main__":
    main()
 M = 1046527 M 1046527 pow(4, i) for i in range(13) for i in range(13) i range(13) range 13 for i in range(13) pow(4, i) pow 4 i POW = [pow(4, i) for i in range(13)] POW [pow(4, i) for i in range(13)] def insert(dic, string):
    # i = 0
    # while dic[(hash1(string) + i*hash2(string)) % M]:
    #     i += 1
    # dic[(hash1(string) + i*hash2(string)) % M] = string
    dic[get_key(string)] = string insert dic[get_key(string)] = string dic[get_key(string)] dic get_key(string) get_key string string dic dic string string def find(dic, string):
    # i = 0
    # while dic[(hash1(string) + i*hash2(string)) % M] and dic[(hash1(string) + i*hash2(string)) % M] != string:
    #     i += 1
    # return True if dic[(hash1(string) + i*hash2(string)) % M] == string else False
    # print(dic[get_key(string)], string)
    return True if dic[get_key(string)] == string else False find return True if dic[get_key(string)] == string else False True if dic[get_key(string)] == string else False dic[get_key(string)] == string dic[get_key(string)] dic get_key(string) get_key string string True False dic dic string string def get_num(char):
    if char == "A":
        return 1
    elif char == "C":
        return 2
    elif char == "G":
        return 3
    else:
        return 4 get_num if char == "A":
        return 1
    elif char == "C":
        return 2
    elif char == "G":
        return 3
    else:
        return 4 char == "A" char "A" return 1 1 elif char == "C":
        return 2
     char == "C" char "C" return 2 2 elif char == "G":
        return 3
     char == "G" char "G" return 3 3 return 4 4 char char def get_key(string):
    num = 0
    for i in range(len(string)):
        num += POW[i] * get_num(string[i])
    return num get_key num = 0 num 0 for i in range(len(string)):
        num += POW[i] * get_num(string[i])
     i range(len(string)) range len(string) len string num += POW[i] * get_num(string[i]) num POW[i] * get_num(string[i]) POW[i] POW i get_num(string[i]) get_num string[i] string i return num num string string def main():
    n = int(input())
    dic = [None] * POW[12]
    # print(dic)
    for i in range(n):
        order, string = input().split()
        if order == "insert":
            insert(dic, string)
        else:
            if find(dic, string):
                print('yes')
            else:
                print('no') main n = int(input()) n int(input()) int input() input dic = [None] * POW[12] dic [None] * POW[12] [None] None POW[12] POW 12 for i in range(n):
        order, string = input().split()
        if order == "insert":
            insert(dic, string)
        else:
            if find(dic, string):
                print('yes')
            else:
                print('no') i range(n) range n order, string = input().split() order input().split() ().split () input split string if order == "insert":
            insert(dic, string)
        else:
            if find(dic, string):
                print('yes')
            else:
                print('no') order == "insert" order "insert" insert(dic, string) insert dic string if find(dic, string):
                print('yes')
            else:
                print('no') find(dic, string) find dic string print('yes') print 'yes' print('no') print 'no' if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main M = 1046527 1046527 M def get_num(char):
    if char == "A":
        return 1
    elif char == "C":
        return 2
    elif char == "G":
        return 3
    else:
        return 4 def get_num(char):
    if char == "A":
        return 1
    elif char == "C":
        return 2
    elif char == "G":
        return 3
    else:
        return 4 get_num POW = [pow(4, i) for i in range(13)] [pow(4, i) for i in range(13)] POW def insert(dic, string):
    # i = 0
    # while dic[(hash1(string) + i*hash2(string)) % M]:
    #     i += 1
    # dic[(hash1(string) + i*hash2(string)) % M] = string
    dic[get_key(string)] = string def insert(dic, string):
    # i = 0
    # while dic[(hash1(string) + i*hash2(string)) % M]:
    #     i += 1
    # dic[(hash1(string) + i*hash2(string)) % M] = string
    dic[get_key(string)] = string insert def get_key(string):
    num = 0
    for i in range(len(string)):
        num += POW[i] * get_num(string[i])
    return num def get_key(string):
    num = 0
    for i in range(len(string)):
        num += POW[i] * get_num(string[i])
    return num get_key def main():
    n = int(input())
    dic = [None] * POW[12]
    # print(dic)
    for i in range(n):
        order, string = input().split()
        if order == "insert":
            insert(dic, string)
        else:
            if find(dic, string):
                print('yes')
            else:
                print('no') def main():
    n = int(input())
    dic = [None] * POW[12]
    # print(dic)
    for i in range(n):
        order, string = input().split()
        if order == "insert":
            insert(dic, string)
        else:
            if find(dic, string):
                print('yes')
            else:
                print('no') main def find(dic, string):
    # i = 0
    # while dic[(hash1(string) + i*hash2(string)) % M] and dic[(hash1(string) + i*hash2(string)) % M] != string:
    #     i += 1
    # return True if dic[(hash1(string) + i*hash2(string)) % M] == string else False
    # print(dic[get_key(string)], string)
    return True if dic[get_key(string)] == string else False def find(dic, string):
    # i = 0
    # while dic[(hash1(string) + i*hash2(string)) % M] and dic[(hash1(string) + i*hash2(string)) % M] != string:
    #     i += 1
    # return True if dic[(hash1(string) + i*hash2(string)) % M] == string else False
    # print(dic[get_key(string)], string)
    return True if dic[get_key(string)] == string else False find
M = 1046527
POW = [pow(4, i) for i in range(13)]


def insert(dic, string):
    # i = 0
    # while dic[(hash1(string) + i*hash2(string)) % M]:
    #     i += 1
    # dic[(hash1(string) + i*hash2(string)) % M] = string
    dic[get_key(string)] = string


def find(dic, string):
    # i = 0
    # while dic[(hash1(string) + i*hash2(string)) % M] and dic[(hash1(string) + i*hash2(string)) % M] != string:
    #     i += 1
    # return True if dic[(hash1(string) + i*hash2(string)) % M] == string else False
    # print(dic[get_key(string)], string)
    return True if dic[get_key(string)] == string else False


def get_num(char):
    if char == "A":
        return 1
    elif char == "C":
        return 2
    elif char == "G":
        return 3
    else:
        return 4


def get_key(string):
    num = 0
    for i in range(len(string)):
        num += POW[i] * get_num(string[i])
    return num


def main():
    n = int(input())
    dic = [None] * POW[12]
    # print(dic)
    for i in range(n):
        order, string = input().split()
        if order == "insert":
            insert(dic, string)
        else:
            if find(dic, string):
                print('yes')
            else:
                print('no')


if __name__ == "__main__":
    main()

