#include <stdio.h>
#include <string.h>
int main(void){
    int num,i,o,t;
    char ope[7],c[13],dictionary[1000000][13]={0},temp[13];
    scanf("%d",&num);
    for(t=0;t<num;t++){
        scanf("%s%s",ope,c);
        if(!strcmp(ope,"insert")){
            for(i=0;dictionary[i][0];i++){
                if(strcmp(c,dictionary[i]) >= 0){
                    break;
                }
            }
            if(t==0)
                strcpy(dictionary[0],c);
            else for(o=i+1;c[0];o++){
                strcpy(temp,dictionary[o]);
                strcpy(dictionary[o],c);
                strcpy(c,temp);
            }
        }
        else{
            for(i=0;dictionary[i][0];i++){
                if(!strcmp(c,dictionary[i])){
                    puts("yes");
                    break;
                }
            }
            if(!dictionary[i][0])
                puts("no");
        }
    }
    return 0;
}