#include <stdio.h>
#include <string.h>

#define M 1000005
#define L 14

char H[M][L];

int gtchar(char m){
    if(m=='A')return 1;
    else if(m=='C')return 2;
    else if(m== 'G')return 3;
    else if(m== 'T')return 4;
    else return 0;
}

int h1(int key){
    return key % M;
}

int h2(int key){
    return (key % (M-1)) + 1;
}

long long gtkey(char m[]){
    long long total = 0, p=1,i;
    for(i=0;i<strlen(m);i++){
        total += p * gtchar(m[i]);
        p *=5;
    }
    return total;
}


int insert(char m[]){
    long long key,i,h;
    key = gtkey(m);
    for(i=0;;i++){
        h=(h1(key) + i * h2(key))%M;
        if( strcmp(H[h],m) == 0)return 1;
        else if( strlen(H[h]) == 0) {
            strcpy(H[h],m);
            return 0;
        }
    }
    return 0;
}

int find(char m[]){
    long long key,i,h;
    int ct=0,j;
    key=gtkey(m);
    for(i=0;;i++){
        h=(h1(key) + i * h2(key)) %M;
        if(strcmp(H[h],m)==0)return 1;
        else if(strlen(H[h])==0)return 0;
    }
    return 0;
}

int main(void){
    int i,n,ct=0;
    char com[9],m[L],ans[M][4];
    for(i=0;i<M;i++)H[i][0] = '\0';
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s%s",com,m);
        if(com[0]=='i'){
            insert(m);
        }
        else if(find(m)==1){
            strcpy(ans[ct],"yes");
            ct++;
            continue;
        }
        else {
            strcpy(ans[ct],"no");
            ct++;
            continue;
        }
    }
    for(i=0;i<ct;i++){
        printf("%s\n",ans[i]);
    }
    return 0;
}

