#include <stdio.h>
#include <string.h>
 
#define N 1000000

int  judge_char(char);
int  key_data(char *);
void insert(char *); 
int  find(char *);

char str[N][15];

int main(){
 
   int i;
   int n;
   int judge;

   int count=0;
  char order[10];
  char data[15];
  char ans[N][5];
    
  scanf("%d",&n);

  for(i=0;i<n;i++){
  scanf("%s %s",order,data);
  if(strcmp(order,"insert")==0){
  insert(data); 
  }
  else if(strcmp(order,"find")==0){
  judge = find(data);
  if(judge==1){
  strcpy(ans[count],"yes");
  count++;
  }
  else{
  strcpy(ans[count],"no");
  count++;
    }
   }
  }

  for(i=0;i<count;i++){
  printf("%s\n",ans[i]);
  }
  
  return 0;
}


int judge_char(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 key_data(char *arr){
  
  int i;
  int p=1;
  int data=0;
  
  for(i=0;i<strlen(arr);i++){
    data += p * judge_char(arr[i]);
    p *= 5;
  } 
  return data;
  }

void insert(char *arr){
  int i;
  int h;
  int h1;
  int h2;
  int key;

  key = key_data(arr);
  
  h1 = key % N;
  h2 = 1 + key % (N -1);

  for(i=0;;i++){
  h = ( h1 + i * h2 ) % N;
  if(str[h][0]=='\0'){
    strcpy(str[h],arr);
    break;
  }
  if(strcmp(str[h],arr)==0) break;
 }  
}
int find(char *arr){
  int i;
  int h;
  int h1;
  int h2;
  int key;

  key = key_data(arr);
  
  h1 = key % N;
  h2 = 1 + key % (N -1);

  for(i=0;;i++){
  h = ( h1 + i * h2 ) % N;
  if(strcmp(str[h],arr)==0) return 1;
  if(str[h][0]=='\0') return -1;
  }
}