import sys

n = int(input())
dct = set()

for line in sys.stdin:

    cmd, val = line.strip().split()

    if cmd == 'insert':
        dct.add(val)

    else:
        if val in dct:
            print('yes')
        else:
            print('no')
 import sys sys n = int(input()) n int(input()) int input() input dct = set() dct set() set for line in sys.stdin:

    cmd, val = line.strip().split()

    if cmd == 'insert':
        dct.add(val)

    else:
        if val in dct:
            print('yes')
        else:
            print('no') line sys.stdin sys stdin cmd, val = line.strip().split() cmd line.strip().split() line.strip().split line.strip() line.strip line strip split val if cmd == 'insert':
        dct.add(val)

    else:
        if val in dct:
            print('yes')
        else:
            print('no') cmd == 'insert' cmd 'insert' dct.add(val) dct.add dct add val if val in dct:
            print('yes')
        else:
            print('no') val in dct val dct print('yes') print 'yes' print('no') print 'no' cmd, val = line.strip().split() line.strip().split() cmd val = line.strip().split() line.strip().split() val n = int(input()) int(input()) n dct = set() set() dct
import sys

n = int(input())
dct = set()

for line in sys.stdin:

    cmd, val = line.strip().split()

    if cmd == 'insert':
        dct.add(val)

    else:
        if val in dct:
            print('yes')
        else:
            print('no')

