n = int(eval(input()))

d = set()

for _ in range(n):

    c, s = input().split()

    if c == 'insert':

        d.add(s)

    else:

        print(('yes' if s in d else 'no'))

import sys

n = int(eval(input()))

d = set()

for i in sys.stdin:

    c, s = i.split()

    if c == 'insert':

        d.add(s)

    else:

        print(('yes' if s in d else 'no'))

n = int(eval(input()))
d = set()
for _ in range(n):
    c, s = input().split()
    if c == "insert":
        d.add(s)
    else:
        print(("yes" if s in d else "no"))

import sys

n = int(eval(input()))
d = set()
for i in sys.stdin:
    c, s = i.split()
    if c == "insert":
        d.add(s)
    else:
        print(("yes" if s in d else "no"))

+import sys + -for _ in range(n): -    c, s = input().split() +for i in sys.stdin: +    c, s = i.split()