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

int stack[1000000];

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

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

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

int insert(int add,int key){
  if(stack[add] == -1){
    stack[add] =key;
    return 1;
  }
  else return 0;
}

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

int find(int key){
  if(stack[key] == key) return 1;
  else 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",instruction);
    scanf("%s",moji);
    if(!strcmp(instruction,"insert")){
      key =  getkey(moji);
      Hash(key);
    }
    else if(!strcmp(instruction,"find")){
      if(find(getkey(moji))) printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}
  