import sys

 

n = int(eval(input()))

dic = {}

input_ = sys.stdin.readlines()

 

for i in input_:

    c, s = i.split()

    if c == 'insert':

        dic[s] = 0

    else:

        if s in dic:

            print('yes')

        else:

            print('no')
import sys





def main():

    _ = int(eval(input()))



    imps = sys.stdin.readlines()



    db = {}

    for imp in imps:

        c, k = imp.split(' ')

        if c == 'insert':

            db[k] = 0

        elif k in db:

            print('yes')

        else:

            print('no')





main()
import sys

n = int(eval(input()))
dic = {}
input_ = sys.stdin.readlines()
for i in input_:
    c, s = i.split()
    if c == "insert":
        dic[s] = 0
    else:
        if s in dic:
            print("yes")
        else:
            print("no")

import sys


def main():
    _ = int(eval(input()))
    imps = sys.stdin.readlines()
    db = {}
    for imp in imps:
        c, k = imp.split(" ")
        if c == "insert":
            db[k] = 0
        elif k in db:
            print("yes")
        else:
            print("no")


main()

-n = int(eval(input())) -dic = {} -input_ = sys.stdin.readlines() -for i in input_: -    c, s = i.split() -    if c == "insert": -        dic[s] = 0 -    else: -        if s in dic: + +def main(): +    _ = int(eval(input())) +    imps = sys.stdin.readlines() +    db = {} +    for imp in imps: +        c, k = imp.split(" ") +        if c == "insert": +            db[k] = 0 +        elif k in db: + + +main()