#include<stdio.h>
#include <stdlib.h>
#include<string.h>
#define M 16777222
//#define M  1046527
int 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] = '0';
    }
}

int getKey(char str[]){
    int sum = 0, p = 1, i;
    for ( i = 0; i < strlen(str); i++ ){
        sum += p*(str[i]-'0');
        p *= 4;
    }
    return sum;
}

int find(char str[]){
    int key;
    key = getKey(str);
    if(H[key] == key) return 1;
    return 0;
}

void insert(char str[]){
    int key = getKey(str);
    H[key] = key;
}

int main(){
    //freopen("out.txt", "w", stdout);
    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;
}

