def resolve():
    N = int(input())
    s = set()
    for _ in range(N):
        a, b = input().split()
        if a == "insert":
            s.add(b)
        else:
            if b in s:
                print("yes")
            else:
                print("no")


resolve()
 def resolve():
    N = int(input())
    s = set()
    for _ in range(N):
        a, b = input().split()
        if a == "insert":
            s.add(b)
        else:
            if b in s:
                print("yes")
            else:
                print("no") resolve N = int(input()) N int(input()) int input() input s = set() s set() set for _ in range(N):
        a, b = input().split()
        if a == "insert":
            s.add(b)
        else:
            if b in s:
                print("yes")
            else:
                print("no") _ range(N) range N a, b = input().split() a input().split() ().split () input split b if a == "insert":
            s.add(b)
        else:
            if b in s:
                print("yes")
            else:
                print("no") a == "insert" a "insert" s.add(b) s.add s add b if b in s:
                print("yes")
            else:
                print("no") b in s b s print("yes") print "yes" print("no") print "no" resolve() resolve def resolve():
    N = int(input())
    s = set()
    for _ in range(N):
        a, b = input().split()
        if a == "insert":
            s.add(b)
        else:
            if b in s:
                print("yes")
            else:
                print("no") def resolve():
    N = int(input())
    s = set()
    for _ in range(N):
        a, b = input().split()
        if a == "insert":
            s.add(b)
        else:
            if b in s:
                print("yes")
            else:
                print("no") resolve
def resolve():
    N = int(input())
    s = set()
    for _ in range(N):
        a, b = input().split()
        if a == "insert":
            s.add(b)
        else:
            if b in s:
                print("yes")
            else:
                print("no")


resolve()

