# ALDS1_4_C.
# ハッシュテーブル。

def get_key(_str):
    key = 0
    for i in range(len(_str)):
        if _str[i] == 'A': key += 1
        elif _str[i] == 'C': key += 2
        elif _str[i] == 'G': key += 3
        elif _str[i] == 'T': key += 4
        key *= 5
    return key
    
def main():
    n = int(input())
    dict = {}
    for i in range(n):
        command = input().split()
        if command[0][0] == 'i':
            dict[get_key(command[1])] = command[1]
        else:
            key = get_key(command[1])
            if key in dict: print('yes')
            else: print('no')
    
if __name__ == "__main__":
    main()
 def get_key(_str):
    key = 0
    for i in range(len(_str)):
        if _str[i] == 'A': key += 1
        elif _str[i] == 'C': key += 2
        elif _str[i] == 'G': key += 3
        elif _str[i] == 'T': key += 4
        key *= 5
    return key
     get_key key = 0 key 0 for i in range(len(_str)):
        if _str[i] == 'A': key += 1
        elif _str[i] == 'C': key += 2
        elif _str[i] == 'G': key += 3
        elif _str[i] == 'T': key += 4
        key *= 5
     i range(len(_str)) range len(_str) len _str if _str[i] == 'A': key += 1
        elif _str[i] == 'C': key += 2
        elif _str[i] == 'G': key += 3
        elif _str[i] == 'T': key += 4
         _str[i] == 'A' _str[i] _str i 'A' elif _str[i] == 'C': key += 2
         _str[i] == 'C' _str[i] _str i 'C' elif _str[i] == 'G': key += 3
         _str[i] == 'G' _str[i] _str i 'G' elif _str[i] == 'T': key += 4
         _str[i] == 'T' _str[i] _str i 'T' key *= 5 key 5 return key key _str _str def main():
    n = int(input())
    dict = {}
    for i in range(n):
        command = input().split()
        if command[0][0] == 'i':
            dict[get_key(command[1])] = command[1]
        else:
            key = get_key(command[1])
            if key in dict: print('yes')
            else: print('no')
     main n = int(input()) n int(input()) int input() input dict = {} dict {} for i in range(n):
        command = input().split()
        if command[0][0] == 'i':
            dict[get_key(command[1])] = command[1]
        else:
            key = get_key(command[1])
            if key in dict: print('yes')
            else: print('no')
     i range(n) range n command = input().split() command input().split() ().split () input split if command[0][0] == 'i':
            dict[get_key(command[1])] = command[1]
        else:
            key = get_key(command[1])
            if key in dict: print('yes')
            else: print('no')
     command[0][0] == 'i' command[0][0] [0] command 0 0 'i' dict[get_key(command[1])] = command[1] dict[get_key(command[1])] dict get_key(command[1]) get_key command[1] command 1 command[1] command 1 key = get_key(command[1]) key get_key(command[1]) get_key command[1] command 1 if key in dict: print('yes')
            else: print('no')
     key in dict key dict if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def get_key(_str):
    key = 0
    for i in range(len(_str)):
        if _str[i] == 'A': key += 1
        elif _str[i] == 'C': key += 2
        elif _str[i] == 'G': key += 3
        elif _str[i] == 'T': key += 4
        key *= 5
    return key
     def get_key(_str):
    key = 0
    for i in range(len(_str)):
        if _str[i] == 'A': key += 1
        elif _str[i] == 'C': key += 2
        elif _str[i] == 'G': key += 3
        elif _str[i] == 'T': key += 4
        key *= 5
    return key
     get_key def main():
    n = int(input())
    dict = {}
    for i in range(n):
        command = input().split()
        if command[0][0] == 'i':
            dict[get_key(command[1])] = command[1]
        else:
            key = get_key(command[1])
            if key in dict: print('yes')
            else: print('no')
     def main():
    n = int(input())
    dict = {}
    for i in range(n):
        command = input().split()
        if command[0][0] == 'i':
            dict[get_key(command[1])] = command[1]
        else:
            key = get_key(command[1])
            if key in dict: print('yes')
            else: print('no')
     main
# ALDS1_4_C.
# ハッシュテーブル。

def get_key(_str):
    key = 0
    for i in range(len(_str)):
        if _str[i] == 'A': key += 1
        elif _str[i] == 'C': key += 2
        elif _str[i] == 'G': key += 3
        elif _str[i] == 'T': key += 4
        key *= 5
    return key
    
def main():
    n = int(input())
    dict = {}
    for i in range(n):
        command = input().split()
        if command[0][0] == 'i':
            dict[get_key(command[1])] = command[1]
        else:
            key = get_key(command[1])
            if key in dict: print('yes')
            else: print('no')
    
if __name__ == "__main__":
    main()

