

def main():
    n = int(input())
    d = set()
    for _ in range(n):
        op, s = input().split()
        if op == 'insert':
            d.add(s)
        else:
            if s in d:
                print('yes')
            else:
                print('no')

if __name__ == '__main__':
    main() def main():
    n = int(input())
    d = set()
    for _ in range(n):
        op, s = input().split()
        if op == 'insert':
            d.add(s)
        else:
            if s in d:
                print('yes')
            else:
                print('no') main n = int(input()) n int(input()) int input() input d = set() d set() set for _ in range(n):
        op, s = input().split()
        if op == 'insert':
            d.add(s)
        else:
            if s in d:
                print('yes')
            else:
                print('no') _ range(n) range n op, s = input().split() op input().split() ().split () input split s if op == 'insert':
            d.add(s)
        else:
            if s in d:
                print('yes')
            else:
                print('no') op == 'insert' op 'insert' d.add(s) d.add d add s if s in d:
                print('yes')
            else:
                print('no') s in d s d print('yes') print 'yes' print('no') print 'no' if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    n = int(input())
    d = set()
    for _ in range(n):
        op, s = input().split()
        if op == 'insert':
            d.add(s)
        else:
            if s in d:
                print('yes')
            else:
                print('no') def main():
    n = int(input())
    d = set()
    for _ in range(n):
        op, s = input().split()
        if op == 'insert':
            d.add(s)
        else:
            if s in d:
                print('yes')
            else:
                print('no') main


def main():
    n = int(input())
    d = set()
    for _ in range(n):
        op, s = input().split()
        if op == 'insert':
            d.add(s)
        else:
            if s in d:
                print('yes')
            else:
                print('no')

if __name__ == '__main__':
    main()
