#include <stdio.h>
#include <math.h>
main(){
  int i,j,n,code;
  char com[7], op, dictionary[262145];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",com);
    j=0; code=0;
    while(j<=8){
      scanf("%c",&op);
      if(op=='\n') break;
      else if(op=='A') code+=1*pow(4,j);
      else if(op=='C') code+=2*pow(4,j);
      else if(op=='G') code+=3*pow(4,j);
      else if(op=='T') code+=4*pow(4,j);
      else j--;
      j++;
    }
    if(com[0] == 'i')
      dictionary[code] = 1;
    if(com[0] == 'f')
      if(dictionary[code] == 1) printf("yes\n"); else printf("no\n");
  }
  return 0;
}