def main():
    n = int(stdinput())

    st = [None] * (4**12)

    for _ in range(n):
        cmd, value = stdinput().split()
        if cmd == 'insert':
            st[get_hash(value)] = 1
        elif cmd == 'find':
            if st[get_hash(value)] == 1:
                print('yes')
            else:
                print('no')

CODES = {'A' : 1, 'C' : 2, 'G' : 3, 'T' : 4}
def get_hash(s):
    base = 1
    h = 0
    for c in s:
        code = CODES[c]
        h += code * base
        base *= 4
    return h

def stdinput():
    from sys import stdin
    return stdin.readline().strip()

if __name__ == '__main__':
    main()
    # import cProfile
    # cProfile.run('main()') def main():
    n = int(stdinput())

    st = [None] * (4**12)

    for _ in range(n):
        cmd, value = stdinput().split()
        if cmd == 'insert':
            st[get_hash(value)] = 1
        elif cmd == 'find':
            if st[get_hash(value)] == 1:
                print('yes')
            else:
                print('no') main n = int(stdinput()) n int(stdinput()) int stdinput() stdinput st = [None] * (4**12) st [None] * (4**12) [None] None 4**12 4 12 for _ in range(n):
        cmd, value = stdinput().split()
        if cmd == 'insert':
            st[get_hash(value)] = 1
        elif cmd == 'find':
            if st[get_hash(value)] == 1:
                print('yes')
            else:
                print('no') _ range(n) range n cmd, value = stdinput().split() cmd stdinput().split() ().split () stdinput split value if cmd == 'insert':
            st[get_hash(value)] = 1
        elif cmd == 'find':
            if st[get_hash(value)] == 1:
                print('yes')
            else:
                print('no') cmd == 'insert' cmd 'insert' st[get_hash(value)] = 1 st[get_hash(value)] st get_hash(value) get_hash value 1 elif cmd == 'find':
            if st[get_hash(value)] == 1:
                print('yes')
            else:
                print('no') cmd == 'find' cmd 'find' if st[get_hash(value)] == 1:
                print('yes')
            else:
                print('no') st[get_hash(value)] == 1 st[get_hash(value)] st get_hash(value) get_hash value 1 print('yes') print 'yes' print('no') print 'no' CODES = {'A' : 1, 'C' : 2, 'G' : 3, 'T' : 4} CODES {'A' : 1, 'C' : 2, 'G' : 3, 'T' : 4} 'A' 'A' 1 'C' 'C' 2 'G' 'G' 3 'T' 'T' 4 def get_hash(s):
    base = 1
    h = 0
    for c in s:
        code = CODES[c]
        h += code * base
        base *= 4
    return h get_hash base = 1 base 1 h = 0 h 0 for c in s:
        code = CODES[c]
        h += code * base
        base *= 4
     c s code = CODES[c] code CODES[c] CODES c h += code * base h code * base code base base *= 4 base 4 return h h s s def stdinput():
    from sys import stdin
    return stdin.readline().strip() stdinput from sys import stdin return stdin.readline().strip() stdin.readline().strip() stdin.readline().strip stdin.readline() stdin.readline stdin readline strip if __name__ == '__main__':
    main()
    # import cProfile
    # cProfile.run('main()') __name__ == '__main__' __name__ '__main__' main() main def get_hash(s):
    base = 1
    h = 0
    for c in s:
        code = CODES[c]
        h += code * base
        base *= 4
    return h def get_hash(s):
    base = 1
    h = 0
    for c in s:
        code = CODES[c]
        h += code * base
        base *= 4
    return h get_hash def stdinput():
    from sys import stdin
    return stdin.readline().strip() def stdinput():
    from sys import stdin
    return stdin.readline().strip() stdinput CODES = {'A' : 1, 'C' : 2, 'G' : 3, 'T' : 4} {'A' : 1, 'C' : 2, 'G' : 3, 'T' : 4} CODES def main():
    n = int(stdinput())

    st = [None] * (4**12)

    for _ in range(n):
        cmd, value = stdinput().split()
        if cmd == 'insert':
            st[get_hash(value)] = 1
        elif cmd == 'find':
            if st[get_hash(value)] == 1:
                print('yes')
            else:
                print('no') def main():
    n = int(stdinput())

    st = [None] * (4**12)

    for _ in range(n):
        cmd, value = stdinput().split()
        if cmd == 'insert':
            st[get_hash(value)] = 1
        elif cmd == 'find':
            if st[get_hash(value)] == 1:
                print('yes')
            else:
                print('no') main
def main():
    n = int(stdinput())

    st = [None] * (4**12)

    for _ in range(n):
        cmd, value = stdinput().split()
        if cmd == 'insert':
            st[get_hash(value)] = 1
        elif cmd == 'find':
            if st[get_hash(value)] == 1:
                print('yes')
            else:
                print('no')

CODES = {'A' : 1, 'C' : 2, 'G' : 3, 'T' : 4}
def get_hash(s):
    base = 1
    h = 0
    for c in s:
        code = CODES[c]
        h += code * base
        base *= 4
    return h

def stdinput():
    from sys import stdin
    return stdin.readline().strip()

if __name__ == '__main__':
    main()
    # import cProfile
    # cProfile.run('main()')
