#include<stdio.h>
#include <stdlib.h>
#include<string.h>
#define M 1000003
//#define M  1046527
long long H[M];

void getChar(char *ch){
    for(int i = 0; i < strlen(ch); i++){
        if ( ch[i] == 'A') ch[i] = '1';
        else if ( ch[i] == 'C') ch[i] = '2';
        else if ( ch[i] == 'G') ch[i] = '3';
        else if ( ch[i] == 'T') ch[i] = '4';
    }
}

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

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M-1)); }
int h(int key, int i) {return (h1(key) + i * h2(key)) % M;}

int find(char str[]){
    long long key,i = 0;
    key = getKey(str);
    while(i <= M)
    {
        int t = h(key, i);
        if(H[t] == key){
            return 1;
        }
        else if(H[t] == -1){
            return 0;
        }
        i++;
    }
    return 0;
}

void insert(char str[]){

    long long i = 0,key;
    key = getKey(str);
    while(1)
    {
        int t = h(key, i);
        if(H[t] == key){
            return ;
        }
        else if(H[t] == -1 )
        {
            H[t] = key;
            return ;
        }
        i++;
    }
}

int main(){
    int i, n;
    char str[14], com[9];
    for ( i = 0; i < M; i++ ) H[i] = -1;
    scanf("%d", &n);

    for ( i = 0; i < n; i++ ){
        scanf(" %s %s", com, str);

        if ( com[0] == 'i' ){
            getChar(str);
            insert(str);
        } else {
            getChar(str);
            if (find(str)){
                printf("yes\n");
            } else {
                printf("no\n");
            }
        }
    }

    return 0;
}
