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

#define N 1000000
#define NIL -1
#define LEN 13

int change(char c);
int makekey(char *);
int insert(char *);
int h1(int);
int h2(int);
int find(char *);

int n;
char H[N][LEN];

int main(){
  
  int i, h;
  char string[LEN], command[7];
 
  for(i=0;i<N;i++){
    H[i][0]='\0';
  }
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s",command,string);
    if(command[0]=='i'){
      insert(string);
    }
    else{
      if(find(string)==1) printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}

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

int makekey(char string[]){  

  int i, sum=0, a=1;

  for(i=0;i<strlen(string);i++){
    sum+=a*(change(string[i]));
    a*=3;
  }
  return sum;
}

int h1(int key){

 return key%N;
}

int h2(int key){

  return 1+(key%(N-1));
}

int find(char string[]){

  int i=0, key, h;

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

int insert(char string[]){

  int key, i=0, h;

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