# -*- coding: utf-8 -*-
"""
Created on Mon Apr 30 13:14:10 2018
ALDS1-4c  implementation with dictionary
@author: maezawa
"""

n = int(input())
a = dict([])
for s in range(n):
    cmd, word = input().split()
    if cmd == 'insert':
        a[word]=''
    else:
        if word in a:
            print('yes')
        else:
            print('no')

 """
Created on Mon Apr 30 13:14:10 2018
ALDS1-4c  implementation with dictionary
@author: maezawa
""" n = int(input()) n int(input()) int input() input a = dict([]) a dict([]) dict [] for s in range(n):
    cmd, word = input().split()
    if cmd == 'insert':
        a[word]=''
    else:
        if word in a:
            print('yes')
        else:
            print('no') s range(n) range n cmd, word = input().split() cmd input().split() ().split () input split word if cmd == 'insert':
        a[word]=''
    else:
        if word in a:
            print('yes')
        else:
            print('no') cmd == 'insert' cmd 'insert' a[word]='' a[word] a word '' if word in a:
            print('yes')
        else:
            print('no') word in a word a print('yes') print 'yes' print('no') print 'no' cmd, word = input().split() input().split() cmd n = int(input()) int(input()) n a = dict([]) dict([]) a word = input().split() input().split() word
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 30 13:14:10 2018
ALDS1-4c  implementation with dictionary
@author: maezawa
"""

n = int(input())
a = dict([])
for s in range(n):
    cmd, word = input().split()
    if cmd == 'insert':
        a[word]=''
    else:
        if word in a:
            print('yes')
        else:
            print('no')


