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

#define N 1500000
#define L 13
  
char moji[N][L], order[7];
  
int h1(int key){
    return key % N;
    }

int h2(int key){
    return  1 + (key % (N-1));
    }
  
int ctoi(char str){
    if(str == 'A') return 1;
    else if(str == 'C') return 2;
    else if(str == 'G') return 3;
    else if(str == 'T') return 4;
    else return 0;
}
  
int getKey(char str[]){
    int sum = 0, time = 1, i;
    for(i = 0; i < strlen(str); i++){
        sum += time * (ctoi(str[i]));
        time *= 4;
    }
    return sum;
}
  
void insert(char str[]){
    int i, key, h;
    key = getKey(str);
    for(i = 0;; i++){
        h = (h1(key) + i * h2(key)) % N;
        if(strcmp(moji[h], str) == 0) break;
        else if(strlen(moji[h]) == 0){
            strcpy(moji[h], str);
            break;
        }
    }
}
  
int find(char str[]){
    int key, i, h;
    key = getKey(str);
    for(i = 0;; i++){
        h = (h1(key) + i * h2(key)) % N;
        if(strcmp(moji[h], str) == 0) return 1;
        else return 0;
    }
}
  
int main(){
    int i, j, num;
    char str[L];
    scanf("%d", &num);
    for(i = 0; i < N; i++) moji[i][0] = '\0';
    for(i = 0; i < num; i++){
        scanf("%s%s", order, str);
        if(strcmp(order, "insert") == 0) insert(str);
        else{ 
            if(find(str) == 1) printf("yes\n"); 
            else  printf("no\n");
        }
    }
    
    return 0;
}