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

#define L 12
#define MAX 20000000 // >4^12 TTTTTTTTTTTT 

int dic[MAX];

int getChar(char c){
  switch(c){
  case 'A':
    return 1;
  case 'C':
    return 2;
  case 'G':
    return 3;
  case 'T':
    return 4;
  }
  return 0;
}

int getKey(char *str){
  int sum,p,i;
  sum = 0;
  p = 1;
  
  for(i = 0; i < strlen(str); i++){
    sum += p * getChar(str[i]);
    p *= 5;
  }
  
  return sum;
}

int main(){
  int n,i;
  char com[6],s[L];

  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%s %s",com,s);
    if(com[0] == 'i')
      dic[getKey(s)] = 1;
    else if(com[0] == 'f'){
      if(dic[getKey(s)])
	printf("yes\n");
      else
	printf("no\n");
    }
  }

  return 0;
}

