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

int nm;
char dic[1000000][14];

/*long long conbert(char wd[]){
    int i;
    long long data = 0;

    for(i = 1; i <= strlen(wd); i++){                              // 1:A 2:C 3:G 4:T
        if(wd[i] == 'A') data += i*5;
        else if(wd[i] == 'C') data += i*10;
        else if(wd[i] == 'G') data += i*15;
        else if(wd[i] == 'T') data += i*20;
    }

    return data;
}*/
int getChar(char ch){
    if(ch == 'A') return 1;
    else if(ch == 'C') return 2;
    else if(ch == 'G') return 3;
    else if(ch == 'T')return 4;
    else return 0;
}

long long getkey(char wd[]){
    long long sum = 0, p = 1, i;
    for(i = 0; i < strlen(wd); i++){
        sum += p*(getChar(wd[i]));
        p *= 5;
    }
    return sum;
}

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

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

int insert(char wd[]){
    long long i = 0, h, key;

    key = getkey(wd);

    for(i = 0; ; i++){
        h = (h1(key)+i*h2(key)) % 1000000;
        if(strcmp(dic[h], wd) == 0) return 1;
        else if(strlen(dic[h]) == 0){
            strcpy(dic[h], wd);
            return 0;
        }
    }
    return 0;
}

void find(char wd[]){
    long long key, i = 0, h;

    key = getkey(wd);

    for(i = 0; ; i++){
        h = (h1(key)+i*h2(key)) % 1000000;
        if(strcmp(dic[h], wd) == 0){
            printf("yes\n");
            return;
        }
        else if(strlen(dic[h]) == 0){
            printf("no\n");
            return;
        }
    }
}

int main(){
    int i, j;
    char op[7];
    char wd[14];
    
    for(i = 0; i < 14; i++) wd[i] = '\0';

    scanf("%d", &nm);

    for(i = 0; i < nm; i++){
        scanf("%s %s", op, wd);
        if(op[0] == 'i'){
            insert(wd);
        }
        else{
            find(wd);
        }
    }


    return 0;
}
