#include<stdio.h>
#include<stdlib.h>
#define N 100000000
#define command 7
#define limit 12
char math[N];
int getChar(char);
int Key(char[]);
int main(){
    int i,n,ans;
    char str[limit],com[command];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s %s",com,str);
        ans=Key(str);
        if (com[0] == 'i'){
            math[ans] = 1;
        } else {
            math[ans]== 1 ? printf("yes\n") : printf("no\n");
        }
    }
}
int Key(char str[]){
    int i=0, k = 0, ans = 1;
    while ('\0'!=str[i]){
        k+=ans*(getChar(str[i]));
        ans*= 5;
        i++;
    }
    return k;
}
int getChar(char ch){
    switch(ch){
        case 'A':
            return 1;
            break;
        case 'C':
            return 2;
            break;
        case 'G':
            return 3;
            break;
        case 'T':
            return 4;
            break;
    }
    return 0;
}
