import sys
input()
rl = sys.stdin.readlines()
d = {}

for i in rl:
    c, s = i.split()
    #if i[0] == 'i':
    if c[0] == 'i':
        #d[i[7:]] = 0
        d[s] = 0
    else:
        #if i[5:] in d:
        if s in d:
            print('yes')
        else:
            print('no') import sys sys input() input rl = sys.stdin.readlines() rl sys.stdin.readlines() sys.stdin.readlines sys.stdin sys stdin readlines d = {} d {} for i in rl:
    c, s = i.split()
    #if i[0] == 'i':
    if c[0] == 'i':
        #d[i[7:]] = 0
        d[s] = 0
    else:
        #if i[5:] in d:
        if s in d:
            print('yes')
        else:
            print('no') i rl c, s = i.split() c i.split() i.split i split s if c[0] == 'i':
        #d[i[7:]] = 0
        d[s] = 0
    else:
        #if i[5:] in d:
        if s in d:
            print('yes')
        else:
            print('no') c[0] == 'i' c[0] c 0 'i' d[s] = 0 d[s] d s 0 if s in d:
            print('yes')
        else:
            print('no') s in d s d print('yes') print 'yes' print('no') print 'no' d = {} {} d rl = sys.stdin.readlines() sys.stdin.readlines() rl s = i.split() i.split() s c, s = i.split() i.split() c
import sys
input()
rl = sys.stdin.readlines()
d = {}

for i in rl:
    c, s = i.split()
    #if i[0] == 'i':
    if c[0] == 'i':
        #d[i[7:]] = 0
        d[s] = 0
    else:
        #if i[5:] in d:
        if s in d:
            print('yes')
        else:
            print('no')