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

#define M 1000000

void hashInsert(int);
int hashSearch(int);
int change(char);

int mozi[M];
char mozi2[12];

int main( ){

  int n,n1,i,j=0,m,key=0,p,key2,hantei;
  char meirei[6];
  
  scanf("%d",&n);

  /*if(n == (int)6){
    printfn("hogehogehogeh");
    }*/
  
  n1=n;
  
  //n = 6;
  //printf("%d\n",n);

  for(i=0;i<M;i++){

    mozi[i]=0;

    }
  
  for(i=0;i<n1;i++){

    //printf("debug1: %d\n", n);

    scanf("%s %s",meirei,mozi2);

    p=1;
    key=0;

    //printf("wa-i1\n");
    
    for(m=0;mozi2[m]!=NULL;m++){
      key2=change(mozi2[m]);
      key+=key2*p;
      p*=5;

      // printf("making key = %d\n",key);
    }

    //printf("debug2: %d\n", n);

    //printf("wa-i2\n");

    if(strcmp(meirei,"insert")==0){

      // printf("wa-i3\n");
      
      hashInsert(key);
      

      //printf("wa-i4\n");
      
    }
    else if(strcmp(meirei,"find")==0){

      //printf("wa-i40\n");
      
      hantei=hashSearch(key);
      
      
      if(hantei==1)printf("yes\n");
      else printf("no\n");
    }
    //printf("wa-i10\n");    

  }

  //printf("wa-i11\n");
  
  return 0;
  
}

void hashInsert(int key){

  int i=0,j;

  while(1){

    // printf("wa-i5\n");

    j=((key%M)+i*(1+key%(M-1)))%M;

    //printf("wa-i6\n");

    if(mozi[j]==NULL){mozi[j]=key;
      // printf("Insert mozi[j]=%d\n",mozi[j]);
      //printf("Insert j=%d\n",j);
      //printf("Insert key=%d\n",key);
      
      // printf("wa-i7\n");
      break;
    }
    else i++;    

  }  
  
}

int hashSearch(int key){

  int i=0,j;

  while(1){
    
    j=((key%M)+i*(1+key%(M-1)))%M;

    //printf("find key=%d\n",key);
    //printf("find j=%d\n",j);
    // printf("find mozi[j]=%d\n",mozi[j]);

    
    if(mozi[j]==key) return 1;
    else if(mozi[j]==NULL || i>=M) return 0;
    else i=i+1;

  }
}


int change(char mozi){

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

}







  

  