#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define M 1046527
#define L 15

typedef long long ll;

char H[M][L]; /* Hash Table */

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;
}

/* convert a string into an integer value */
ll getKey(char str[]){
  ll sum = 0, p = 1;
  int i;
  
  for ( i = 0; i < (int)strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 3;
  }
  //printf("%lld\n",sum);
  return sum;
}

int h1(ll key){
  return key%M;
}
int h2(ll key){
  return 1+key%(M-1);
}

int find(char str[]){
  int i=0,j=0;
  int f,g;

  ll key = getKey(str);
  f = h1(key);
  g = h2(key);

  while(1){
    i = ( f + g*j )%M;
    if( strcmp(H[i],str) == 0 ) return 1;
    else if( strlen(H[i]) == 0 ) return 0;
    j++;
  }
  return 0;
}

int insert(char str[]){
  int i=0,j=0;
  int f,g;

  ll key = getKey(str);
  f = h1(key);
  g = h2(key);

  while(1){
    i = ( f + g*j )%M;
    if( strcmp(H[i], str) == 0 ) return 0;  //check if str already exists

    if( H[i][0] == '\0' ){
      strcpy(H[i], str);
      return 1;
    }
    j++;
  }
}

int main(){
  int i, n;
  char str[L], com[10];
  
  for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
  scanf("%d", &n);
    
  for ( i = 0; i < n; i++ ){
    scanf("%s %s", com, str);
	
    if ( com[0] == 'i' ){
      insert(str);
    }
    else {
      if (find(str) == 1){
	printf("yes\n");
      }
      else {
	printf("no\n");
      }
    }
  }
  return 0;
}

