#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
#define M 1000007
#define L 14
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;
}
long long getKey(char s[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < slen(s); i++ ){
    sum += p*(getChar(s[i]));
    p *= 5;
  }
  return sum;
}
 
int h1(int key){ 
  return key % M; 
}
int h2(int key){ 
  return 1 + (key % (M + 1)); 
}
 
int find(char s[]){
  int i;
  long key;//long key;
  key = getKey(s);
  for(i = 0; i < M; i++){
    if(Hs[(h1(key) + i * h2(key)) % M][0] == '\0') return 0;
    if(scmp(Hs[(h1(key) + i * h2(key)) % M], s) == 0) return 1;
  }
  return 0;
}
 
int insert(char s[]){
   
  int i =0;
  long key;//long key;
 
  key = getKey(s);
 
  while(1){
    if(i == M) break;
    if(Hs[(h1(key) + i * h2(key)) % M][0] == '\0'){
      scpy(Hs[(h1(key) + i * h2(key)) % M],s);
      return 0;
    }
    else i++;
  }
}
 
int main(){
  int i, n, h;
  char s[L], cm[9];
  for ( i = 0; i < M; i++ ) {
    Hs[i][0] = '\0';
  } 
  scanf("%d", &n);
   
  for ( i = 0; i < n; i++ ){
    scanf("%s %s", cm, s);    
    if ( cm[0] == 'i' ){
      insert(s);
    } 
    else {
      if(find(s)) {
        printf("yes\n");
      }
      else {
        printf("no\n");
      }
    }
  }
  return 0;
}