#include <stdio.h>
#include <string.h>
int hash1();
int hash2();
void Hash(int,char *);
int insert(int,char *);
int getkey(char *);
void init();
int  find( char *);

char stack[1000000][13];

void init(){
  int i;
  for(i=0;i<1000000;i++) stack[i][0]='0';
}

int hash1(int key){
  return (key % 1000000);
}

int hash2(int key){
  return (1+(key) % 999999);
}

int insert(int add,char *s){
  if(stack[add][0] == '0'){
    strcpy(stack[add],s);
    return 1;
  }
  else return 0;
}

void Hash(int key,char *s){
  int hash;
  int i =0;
  while(1){
    hash = (hash1(key)+i*hash2(key))%1000000;
    if(insert(hash,s)) break;
    i++;
  }
}

int find(char *s){
  int i=0;
  for(i=0;i<1000000;i++){
    if(!strcmp(stack[i],s)) return 1;
  }
  return 0;
}

int getkey(char *s){
  int i;
  int key =0;
  for(i=0;i<strlen(s);i++){
    if(s[i] == 'A') key+=1;
    else if (s[i] == 'C') key +=2;
    else if (s[i] == 'G') key += 3;
    else key += 4;
  }
  return key;
}
int main(){
  int t,n,i;
  char instruction[6];
  char moji[12];
  int key;
  init();
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s",instruction,moji);
    if(!strcmp(instruction,"insert")){
      key =  getkey(moji);
      Hash(key,moji);
    }
    else if(!strcmp(instruction,"find")){
      if(find(moji)) printf("yes");
      else printf("no");
    }
  }
  return 0;
}
  