#include <stdio.h>
#include <string.h>
#define M 1000003
#define L 14

void Insert(char *);
int Find(char *);
int getChar(char );
int getKey(char *);
int h1(int);
int h2(int);

char H[M][L];

int main()
{
  int com_num,i;
  char command[9],str[L];

  for(int i =0; i < M; i++) H[i][0] = '\0';
  
  scanf("%d",&com_num);
  
  for(i = 0; i < com_num; i++){
    scanf("%s %s",command,str);
    if(command[0] == 'i') Insert(str);
    else{
      if(Find(str) == 1) printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}


void Insert(char str[]){
  int i,n,key =  getKey(str);
  for(i = 0; i < M; i++){
    n = (h1(key)+i*h2(key))%M;
    if(H[n][0] == '\0'){
      strcpy(H[n],str);
      break;
    }
  }
}

int Find(char str[]){
  int i,n,key;
  key = getKey(str);
  for(i = 0; i < M ;i++){
    n = (h1(key)+i*h2(key))%M;
    if(strcmp(H[n],str) == 0) return 1;
    else if(strlen(H[n]) == 0) return 0;
  }
  return 0;
}

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;
  else return 0;
}

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 h1(int key){
  return key%M;
}

int h2(int key){
  return 1 + (key%(M-1));
}

