#include<stdio.h>

#define LEN 10000000
int dic[LEN];

int hash(char *str){
    char *p = str;
    int ans = 0;
    while(*p != '\0'){
        if(*p == 'A'){
            ans = ans*4 + 0;
        }
        else if(*p == 'C'){
            ans = ans*4 + 1;
        }
        else if(*p == 'G'){
            ans = ans*4 + 2;
        }
        else{
            ans = ans*4 + 3;
        }
        p++;
    }
    return ans;
}

void insert(char* str){
    dic[hash(str)] = 1;
}

int find(char* str){
    if(dic[hash(str)] == 1) return 1;
    return 0;
}

int main(void){
    int n;
    int i;
    char operand[13];
    char operator[10];
    
    scanf("%d", &n);
    
    for(i=0; i<n; i++){
        scanf("%s %s", operator, operand);
        if(operator[0] =='i'){
            insert(operand);
        }
        else if(operator[0] =='f'){
            printf("%s\n", 1 == find(operand)?"yes":"no");
        }
    }
    return 0;
}