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

#define N 1000000
#define L 14

int getChar(char c){
  if(c == 'A') return 1;
  else if(c =='C') return 2;
  else if(c =='G') return 3;
  else if(c =='T') return 4;
  else return 0;
}

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

int h1(int key){
  return key % N;
}

int h2(int key){
  return 1 + (key % (N - 1));
}

char H[N][L];

int find(char str[]){
  int key, i, h;
  key = getKey(str);

  i = 0;
  while(1){
    h = (h1(key) + i*h2(key)) % N;
    if(strcmp(H[h], str) == 0) return 1;
    else if(strlen(H[h]) == 0) return 0;
    i++;
  }
  return 0;
}

int insert(char str[]){
  long long key, i, h;
  key = getKey(str);

  i=0;
  while(1){
    h = (h1(key) + i*h2(key)) % N;
    if(strcmp(H[h], str) == 0) return 1;
    else if(strlen(H[h]) == 0){
      strcpy(H[h], str);
      return 0;
    }
    i++;
  }
  return 0;
}

int main(){
  int n, i;
  char str[L],instruction[L];

  for(i = 0; i < N; i++){
    H[i][0] = '\0';
  }

  scanf("%d", &n);

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

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