import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    N = int(input())
    before = set()
    for _ in range(N):
        s,t = input().split()
        if s == 'insert':
            before.add(t)
        else:
            if t in before:
                print('yes')
            else:
                print('no')
if __name__ == '__main__':
    main() import sys sys sys.setrecursionlimit(10000000) sys.setrecursionlimit sys setrecursionlimit 10000000 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 INF = 10 ** 15 INF 10 ** 15 10 15 def main():
    N = int(input())
    before = set()
    for _ in range(N):
        s,t = input().split()
        if s == 'insert':
            before.add(t)
        else:
            if t in before:
                print('yes')
            else:
                print('no') main N = int(input()) N int(input()) int input() input before = set() before set() set for _ in range(N):
        s,t = input().split()
        if s == 'insert':
            before.add(t)
        else:
            if t in before:
                print('yes')
            else:
                print('no') _ range(N) range N s,t = input().split() s input().split() ().split () input split t if s == 'insert':
            before.add(t)
        else:
            if t in before:
                print('yes')
            else:
                print('no') s == 'insert' s 'insert' before.add(t) before.add before add t if t in before:
                print('yes')
            else:
                print('no') t in before t before print('yes') print 'yes' print('no') print 'no' if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    N = int(input())
    before = set()
    for _ in range(N):
        s,t = input().split()
        if s == 'insert':
            before.add(t)
        else:
            if t in before:
                print('yes')
            else:
                print('no') def main():
    N = int(input())
    before = set()
    for _ in range(N):
        s,t = input().split()
        if s == 'insert':
            before.add(t)
        else:
            if t in before:
                print('yes')
            else:
                print('no') main INF = 10 ** 15 10 ** 15 INF MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    N = int(input())
    before = set()
    for _ in range(N):
        s,t = input().split()
        if s == 'insert':
            before.add(t)
        else:
            if t in before:
                print('yes')
            else:
                print('no')
if __name__ == '__main__':
    main()
