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

#define MAX 1046527
#define LE 14
//#define FUN1(key) (key%MAX)
//#define FUN2(key) (1 + (key % (MAX - 1)))
char ch[MAX][LE];

//将字符解析为数字
int getIndex(char c) {
    if(c == 'A')
        return 1;
    else if(c == 'C')
        return 2;
    else if(c == 'G')
        return 3;
    else
        return 4;

}

//将字符串解析为下标
long long getKey(char str[]) {
    long long p = 1, res = 0, i;
    for(i = 0; i < strlen(str); i++) {
        res += p * (getIndex(str[i]));
        p *= 5;
    }
    return res;
}


int fun1(int key){return key%MAX;}
int fun2(int key){return 1+(key%(MAX-1));}

//查找
int find(char str[]) {
    long long key, i, ind;
    key = getKey(str);
    for(i = 0;; i++) {
        ind = (key + fun2(key)) % MAX;
        if(strcmp(ch[ind], str) == 0)  //已经存在
            return 1;
        else if(strlen(ch[ind]) == 0) { //目标位置为空
            return 0;
        }
    }
    return 0;
}

//向数组插入字符串
int insert(char str[]) {
    long long key, i, ind;
    key = getKey(str);
    for(i = 0;; i++) {
        ind = (key + fun2(key)) % MAX;
        if(strcmp(ch[ind], str) == 0)  //已经存在
            return 1;
        else if(strlen(ch[ind]) == 0) { //目标位置为空
            strcpy(ch[ind], str);//进行保存
            return 0;
        }
    }
    return 0;
}


int main() {
    int cou, i;
    char flag[9], temp[LE];
    scanf("%d", &cou);
    for(i = 0; i < cou; i++) {
        scanf("%s %s", flag, temp);
        if(flag[0] == 'i') {
            insert(temp);
        } else {
            if(find(temp)) {
                printf("yes\n");
            } else {
                printf("no\n");
            }
        }
    }
    return 0;
}

