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

char c[13];
int H[10000000];
int num;



/*????????????????????£?¨?*/

int ghash(void);
int gchar(char);
void insert(void);
void find(void);



/*main??¢??°*/
int main(){
  char str[7];
  int i;


  /*????????????*/
  scanf("%d",&num);

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

    if(strcmp("insert",str)==0){
      insert();
    }
    if(strcmp("find",str)==0){
      find();
    }
  }

  return 0;
}



void insert(){
  H[ghash()] = 1;
}


void find(){
  if(H[ghash()]==1)
    puts("yes");
  else puts("no");
}


/*???????????\??¢??°*/
int ghash(void){
  int hash1=0,i,p=1;

  for(i=0;i<strlen(c);i++){
    hash1 += p*(gchar(c[i]));
    p *= 7;
  }
  return hash1;
}



int gchar(char c){

  if(c=='A')return 1;
  else if(c=='C')return 2;
  else if(c=='G')return 3;
  else return 4;

}