#include <stdio.h>
#include <string.h>
#define N 16777217
/*const int N = 16777217;*/
int conv(char);
int hash(char []);
void insertElm(int);
char findElm(int);

int n;
char data[N];

main(){
  char com[13], len[13];
  int i;
  memset(data, 0, N);
  
  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%s", com);
    scanf("%s", len);
    if(!strcmp(com, "insert")) insertElm(hash(len));
    else printf("%s\n", (findElm(hash(len)) ? "yes" : "no"));
  }
  return 0;
}

int conv(char c){  
  if(c=='A')return 1;
  else if(c=='C')return 2;
  else if(c=='G')return 3;
  else if(c=='T')return 4; 
}
 
int hash(char len[10]){
  int res=0, size=strlen(len), r=1, i;
  for(i=size-1;i>=0;i--){
    res += r * conv(len[i]);
    r *= 4;
  }
  return res;
}
 
void insertElm(int x){
  data[x] = 1;
}
 
char findElm(int x){
  return data[x];
}


