n = int(input())
dic_A = set()
dic_C = set()
dic_G = set()
dic_T = set()
for i in range(n) :
    p, string = input().split()
    if p == 'insert' :
        if string[0] == 'A' :
            dic_A.add(string)
        elif string[0] == 'C' :
            dic_C.add(string)
        elif string[0] == 'G' :
            dic_G.add(string)
        else :
            dic_T.add(string)
    else :
        if string[0] == 'A' :
            if string in dic_A :
                print('yes')
            else :
                print('no')
        elif string[0] == 'C' :
            if string in dic_C :
                print('yes')
            else :
                print('no')
        elif string[0] == 'G' :
            if string in dic_G :
                print('yes')
            else :
                print('no')
        else :
            if string in dic_T :
                print('yes')
            else :
                print('no') n = int(input()) n int(input()) int input() input dic_A = set() dic_A set() set dic_C = set() dic_C set() set dic_G = set() dic_G set() set dic_T = set() dic_T set() set for i in range(n) :
    p, string = input().split()
    if p == 'insert' :
        if string[0] == 'A' :
            dic_A.add(string)
        elif string[0] == 'C' :
            dic_C.add(string)
        elif string[0] == 'G' :
            dic_G.add(string)
        else :
            dic_T.add(string)
    else :
        if string[0] == 'A' :
            if string in dic_A :
                print('yes')
            else :
                print('no')
        elif string[0] == 'C' :
            if string in dic_C :
                print('yes')
            else :
                print('no')
        elif string[0] == 'G' :
            if string in dic_G :
                print('yes')
            else :
                print('no')
        else :
            if string in dic_T :
                print('yes')
            else :
                print('no') i range(n) range n p, string = input().split() p input().split() ().split () input split string if p == 'insert' :
        if string[0] == 'A' :
            dic_A.add(string)
        elif string[0] == 'C' :
            dic_C.add(string)
        elif string[0] == 'G' :
            dic_G.add(string)
        else :
            dic_T.add(string)
    else :
        if string[0] == 'A' :
            if string in dic_A :
                print('yes')
            else :
                print('no')
        elif string[0] == 'C' :
            if string in dic_C :
                print('yes')
            else :
                print('no')
        elif string[0] == 'G' :
            if string in dic_G :
                print('yes')
            else :
                print('no')
        else :
            if string in dic_T :
                print('yes')
            else :
                print('no') p == 'insert' p 'insert' if string[0] == 'A' :
            dic_A.add(string)
        elif string[0] == 'C' :
            dic_C.add(string)
        elif string[0] == 'G' :
            dic_G.add(string)
        else :
            dic_T.add(string)
     string[0] == 'A' string[0] string 0 'A' dic_A.add(string) dic_A.add dic_A add string elif string[0] == 'C' :
            dic_C.add(string)
         string[0] == 'C' string[0] string 0 'C' dic_C.add(string) dic_C.add dic_C add string elif string[0] == 'G' :
            dic_G.add(string)
         string[0] == 'G' string[0] string 0 'G' dic_G.add(string) dic_G.add dic_G add string dic_T.add(string) dic_T.add dic_T add string if string[0] == 'A' :
            if string in dic_A :
                print('yes')
            else :
                print('no')
        elif string[0] == 'C' :
            if string in dic_C :
                print('yes')
            else :
                print('no')
        elif string[0] == 'G' :
            if string in dic_G :
                print('yes')
            else :
                print('no')
        else :
            if string in dic_T :
                print('yes')
            else :
                print('no') string[0] == 'A' string[0] string 0 'A' if string in dic_A :
                print('yes')
            else :
                print('no')
         string in dic_A string dic_A print('yes') print 'yes' print('no') print 'no' elif string[0] == 'C' :
            if string in dic_C :
                print('yes')
            else :
                print('no')
         string[0] == 'C' string[0] string 0 'C' if string in dic_C :
                print('yes')
            else :
                print('no')
         string in dic_C string dic_C print('yes') print 'yes' print('no') print 'no' elif string[0] == 'G' :
            if string in dic_G :
                print('yes')
            else :
                print('no')
         string[0] == 'G' string[0] string 0 'G' if string in dic_G :
                print('yes')
            else :
                print('no')
         string in dic_G string dic_G print('yes') print 'yes' print('no') print 'no' if string in dic_T :
                print('yes')
            else :
                print('no') string in dic_T string dic_T print('yes') print 'yes' print('no') print 'no' dic_T = set() set() dic_T dic_G = set() set() dic_G dic_A = set() set() dic_A p, string = input().split() input().split() p n = int(input()) int(input()) n dic_C = set() set() dic_C string = input().split() input().split() string
n = int(input())
dic_A = set()
dic_C = set()
dic_G = set()
dic_T = set()
for i in range(n) :
    p, string = input().split()
    if p == 'insert' :
        if string[0] == 'A' :
            dic_A.add(string)
        elif string[0] == 'C' :
            dic_C.add(string)
        elif string[0] == 'G' :
            dic_G.add(string)
        else :
            dic_T.add(string)
    else :
        if string[0] == 'A' :
            if string in dic_A :
                print('yes')
            else :
                print('no')
        elif string[0] == 'C' :
            if string in dic_C :
                print('yes')
            else :
                print('no')
        elif string[0] == 'G' :
            if string in dic_G :
                print('yes')
            else :
                print('no')
        else :
            if string in dic_T :
                print('yes')
            else :
                print('no')
