#include <stdio.h>
#include <string.h>
 
#define MAX 30000000
 
int array[MAX];
char s[13];
 
int getChar(char ch){
  if(ch == 'A')
    {
    return 1;
  }
  else if(ch == 'C')
    {
    return 2;
  }
  else if(ch == 'G')
    {
    return 3;
  }
  return 4;
}
 
int gainKagi(){
  
  int sum = 0,p = 1;
  int i;
 
  for(i = 0 ; i < strlen(s) ; i++){
    sum += p * (gainChar(s[i]));
    p *= 5;
  }
  return sum;
}
 
int findOut(){
  int key = gainKagi();
 
  if(array[key]){
    return 1;
  }
 
  return 0;
}
 
void insert(){
  array[gainKagi()] = 1;
}

int main(){
  int n;
  char array2[7];
 
  scanf("%d" ,&n);
  
  while(n--){
    
    scanf("%s %s" ,array2 ,s);
 
    if(array2[0] == 'i')
      {
      insert();
    }
    
    else{
      if(findOut())
	{
    puts("yes");
      }
      else{
    puts("no");
      }
    }
  }
 
  return 0;
}