#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXORDER 1046527
#define TRUE 1
#define FALSE 0

long dictionary[MAXORDER];

short GetNum(char c){
    if(c == 'A') return 1;
    else if(c == 'C') return 2;
    else if(c == 'G') return 3;
    else if(c == 'T') return 4;
    else return 0;
}

long GetKey(char *word){
    int i,len,p=1;
    long key=0;

    len = strlen(word);
    for(i=0; i<len; i++){
        key += p*GetNum(word[i]);
        p*=5;
    }
    return key;
}

int h1(long key){return key % MAXORDER;}
int h2(long key){return 1 + (key % (MAXORDER - 1));}

void Insert(long key){
    int i,hash;

    for(i=0;;i++){
        hash = (h1(key) + i*h2(key)) % MAXORDER;
        if(dictionary[hash] == 0){
            dictionary[hash] = key;
            return;
        }else if(dictionary[hash] == key){
            return;
        }
    }
    return;
}

int Find(long key){
    int i,hash;

    for(i=0;;i++){
        hash = (h1(key) + i*h2(key)) % MAXORDER;
        if(dictionary[hash] == key){
            return TRUE;
        }else if(dictionary[hash] == 0){
            return FALSE;
        }
    }
    return FALSE;
}

int main(){
    int i,n,j=0;
    long key;
    char order[7],word[13];
    short isFound[MAXORDER];

    for(i=0; i<MAXORDER; i++){
        dictionary[i] = 0;
    }

    scanf("%d",&n);
    for(i=1; i<=n; i++){
        scanf("%s %s",order,word);
        key = GetKey(word);

        if(order[0]=='i'){
            Insert(key);
        }else if(order[0]=='f'){
            isFound[j++] = Find(key);
        }else{
            printf("Invalid Order!!\n");
            exit(1);
        }
    }

    for(i=0; i<j; i++){
        if(isFound[i]) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}
