# -*- coding: utf-8 -*-
import sys

htable = [0] * 4 ** 12


def to_int(s):
    if s == 'A':
        return 1
    elif s == 'C':
        return 2
    elif s == 'G':
        return 3
    else:
        return 4


def to_hash(string):
    h = 0
    for i, s in enumerate(string):
        ints = to_int(s)
        h += 4**i * ints

    return h


def insert(string):
    h = to_hash(string)
    htable[h] = 1


def find(string):
    h = to_hash(string)
    if htable[h]:
        print('yes')
    else:
        print('no')


# if __name__ == '__main__':

n = int(input())

for line in sys.stdin:
    cmd, string = line.strip().split()

    if cmd == 'insert':
        insert(string)
    else:
        find(string)
 import sys sys htable = [0] * 4 ** 12 htable [0] * 4 ** 12 [0] 0 4 ** 12 4 12 def to_int(s):
    if s == 'A':
        return 1
    elif s == 'C':
        return 2
    elif s == 'G':
        return 3
    else:
        return 4 to_int if s == 'A':
        return 1
    elif s == 'C':
        return 2
    elif s == 'G':
        return 3
    else:
        return 4 s == 'A' s 'A' return 1 1 elif s == 'C':
        return 2
     s == 'C' s 'C' return 2 2 elif s == 'G':
        return 3
     s == 'G' s 'G' return 3 3 return 4 4 s s def to_hash(string):
    h = 0
    for i, s in enumerate(string):
        ints = to_int(s)
        h += 4**i * ints

    return h to_hash h = 0 h 0 for i, s in enumerate(string):
        ints = to_int(s)
        h += 4**i * ints

     i s enumerate(string) enumerate string ints = to_int(s) ints to_int(s) to_int s h += 4**i * ints h 4**i * ints 4**i 4 i ints return h h string string def insert(string):
    h = to_hash(string)
    htable[h] = 1 insert h = to_hash(string) h to_hash(string) to_hash string htable[h] = 1 htable[h] htable h 1 string string def find(string):
    h = to_hash(string)
    if htable[h]:
        print('yes')
    else:
        print('no')


# if __name__ == '__main__': find h = to_hash(string) h to_hash(string) to_hash string if htable[h]:
        print('yes')
    else:
        print('no')


# if __name__ == '__main__': htable[h] htable h print('yes') print 'yes' print('no') print 'no' string string n = int(input()) n int(input()) int input() input for line in sys.stdin:
    cmd, string = line.strip().split()

    if cmd == 'insert':
        insert(string)
    else:
        find(string) line sys.stdin sys stdin cmd, string = line.strip().split() cmd line.strip().split() line.strip().split line.strip() line.strip line strip split string if cmd == 'insert':
        insert(string)
    else:
        find(string) cmd == 'insert' cmd 'insert' insert(string) insert string find(string) find string def insert(string):
    h = to_hash(string)
    htable[h] = 1 def insert(string):
    h = to_hash(string)
    htable[h] = 1 insert cmd, string = line.strip().split() line.strip().split() cmd string = line.strip().split() line.strip().split() string def find(string):
    h = to_hash(string)
    if htable[h]:
        print('yes')
    else:
        print('no')


# if __name__ == '__main__': def find(string):
    h = to_hash(string)
    if htable[h]:
        print('yes')
    else:
        print('no')


# if __name__ == '__main__': find htable = [0] * 4 ** 12 [0] * 4 ** 12 htable n = int(input()) int(input()) n def to_int(s):
    if s == 'A':
        return 1
    elif s == 'C':
        return 2
    elif s == 'G':
        return 3
    else:
        return 4 def to_int(s):
    if s == 'A':
        return 1
    elif s == 'C':
        return 2
    elif s == 'G':
        return 3
    else:
        return 4 to_int def to_hash(string):
    h = 0
    for i, s in enumerate(string):
        ints = to_int(s)
        h += 4**i * ints

    return h def to_hash(string):
    h = 0
    for i, s in enumerate(string):
        ints = to_int(s)
        h += 4**i * ints

    return h to_hash
# -*- coding: utf-8 -*-
import sys

htable = [0] * 4 ** 12


def to_int(s):
    if s == 'A':
        return 1
    elif s == 'C':
        return 2
    elif s == 'G':
        return 3
    else:
        return 4


def to_hash(string):
    h = 0
    for i, s in enumerate(string):
        ints = to_int(s)
        h += 4**i * ints

    return h


def insert(string):
    h = to_hash(string)
    htable[h] = 1


def find(string):
    h = to_hash(string)
    if htable[h]:
        print('yes')
    else:
        print('no')


# if __name__ == '__main__':

n = int(input())

for line in sys.stdin:
    cmd, string = line.strip().split()

    if cmd == 'insert':
        insert(string)
    else:
        find(string)

