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

typedef struct{
	char order[10];
	char word[15];
	int tag;
} input;

int conv(char *word){
    int n = strlen(word);
    int temp=0;
    int k=0, m = 1;
    int i;
    for(i=0; i<n; i++){
        switch (word[i]){
            case 'A':
                temp=1;
                break;
            case 'C':
                temp=2;
                break;
            case 'G':
                temp=3;
                break;
            case 'T':
                temp=4;
                break;
        }
        k += temp*m;
        m = m * 5;
    }
    return k;
}

int main(void){
    int n;
    int i;
    int k;
    int j=0;
    input *in;
    int *dict;
    scanf("%d", &n);
    in =(input*)malloc(n*sizeof(input));
    dict = (int*)malloc(245000000*sizeof(int));
	memset(dict, '0', sizeof(dict));
    for(i=0; i<n; i++){
        scanf("%s", &in[i].order);
        scanf("%s", &in[i].word);
    	in[i].tag = conv(in[i].word);
    }
    for(i=0; i<n; i++){
        if(strcmp(in[i].order, "insert")==0){
            dict[in[i].tag]=1;
            j++;
        }else{
            if(dict[in[i].tag]==1){
                printf("yes\n");
            }else{
                printf("no\n");
            }
        }
    }
    free(in);
    free(dict);
    return 0;
}
