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

#define M 1000213

void insert(char*);
int find(char*);
int get_key(char*);
int get_keycode(char);
int get_hash_num(int,int);

char hash[M][13]={"\0"};

int main(void){
  int n;
  int i;
  char str[13],input[7];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s %s",input,str);

    if(input[0]=='i') insert(str);

    if(input[0]=='f'){
      if(find(str)==1) printf("yes\n");
      else printf("no\n");
    }
  }

  return 0;
}

void insert(char *str){
  int i=0,hash_num,data;

  data=get_key(str);

  while(1){
    hash_num=get_hash_num(data,i);
    if(strcmp(hash[hash_num],"\0")==0){
      strcpy(hash[hash_num],str);
      break;
    }
    i++;
  }

}

int find(char *str){
  int data,hash_num,i=0;

  data=get_key(str);
 
  while(1){
    hash_num=get_hash_num(data,i);
    if(strcmp(hash[hash_num],"\0")==0) return 0;
    if(strcmp(hash[hash_num],str)==0) return 1;
    i++;
  }
}

int get_key(char *str){
  int data=0,cnt=0,p=1;

  while(str[cnt]!='\0'){
    data+=p*get_keycode(str[cnt]);
    p*=5;
    cnt++;
  }

  return data;
}

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

int get_hash_num(int data,int i){
  return ((data%M)+i*(data%(M-1)+1))%M;
}