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

#define MAX 1000000
#define L 14

char H[MAX][L];

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

int getvalue(char ary[]){
  int sum=0,a=1,i;
  for(i=0;i<strlen(ary);i++){
    sum+=a*(ctoi(ary[i]));
    a*=5;
  }
  return sum;
}

int jud1(int key){return key%MAX;}
int jud2(int key){return 1+(key%(MAX-1));}

int find(char ary[]){
  int key,i,jud;
  key=getvalue(ary);
  for(i=0;;i++){
    jud=(jud1(key)+i*jud2(key))%MAX;
    if(strcmp(H[jud],ary)==0)return 1;
    else if(strlen(H[jud])==0)return 0;
  }
  return 0;
}

int insert(char ary[]){
  
  int key,i,jud;
  
  key=getvalue(ary);
  for(i=0;;i++){
    jud=(jud1(key)+i*jud2(key))%MAX;
    if(strcmp(H[jud],ary)==0)return 1;
    else if(strlen(H[jud])==0){
      strcpy(H[jud],ary);
      return 0;
    }
  }
  return 0;
}

int main(){
  int i,n;
  char ary[L],command[9];
  for(i=0;i<MAX;i++)H[i][0]='\0';
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s",command,ary);
    if(command[0]=='i'){
      insert(ary);
    }
    else{
      if(find(ary)){
	printf("yes\n");
      }
      else printf("no\n");
    }
  }
  return 0;
}

	

		     
		     
 

