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

#define N 1000000
#define M 12
#define L 14
char H[M][L];

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}
int getKey(char str[]){
  int sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}


int main(){
  int i, j, n, h=0, k=0, flag=1, m=0;
  char str[L], com[9];
  
  for(i = 0; i < 10; i++){
    scanf("%d",&n);

    for(i = 0; i < n; i++){
      
      scanf("%s%s",com, str);
      if(com[0] == 'i'){
	k = getKey(str);
	while(1){
	  if(H[m] == NULL) break;
	  m++;
	  h = (k%M + m*(1+k%(M-1)))%M;
	}
	scanf("%s",H[h]);
      }
      else{
	for(j = 1; j < M; j++){
	  if(strcmp(str,H[j]) == 0) flag = 0;
	}
	if(flag == 0) printf("yes\n");
	else printf("no\n");
      }
    }
  } 
  return 0;
}