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

int Change_to_number(char);

int main(){
  char command[7],str[13];
  int i,n,*data,number;
  data = malloc(sizeof(int)*22369620);
  //for(i=0;i<22369620;i++)data[i]=0;
  scanf("%d",&n);
  while(n--){
    number = 0;
    scanf("%s %s",command,str);
    if(command[0] == 'i'){
      for(i=0;i<strlen(str);i++){
	number += pow(4,i)*Change_to_number(str[i]);
      }
      data[number-1]=1;
    }
    else{
      for(i=0;i<strlen(str);i++){
	number += pow(4,i)*Change_to_number(str[i]);
      }
      if(data[number-1]==1)printf("yes\n");
      else printf("no\n");
    }
  }
  free(data);
}
int Change_to_number(char c){
  if(c == 'A')return 1;
  else if(c == 'C')return 2;
  else if(c == 'G')return 3;
  else return 4;
}

