#include<stdio.h>
#include<string.h>
#define N 1000010
#define M 14
char H[N][M];
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 str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}
int h1(int key){ return key%N; }
int h2(int key){ return (1+key)%(N-1); }
int find(char str[]){
  long long ooh;
  int i = 0;
  long long sum = getKey(str);
  while(1){
    ooh = (h1(sum)+ i * h2(sum)) % N;
    if(strcmp(H[ooh], str) == 0) return 1;
    if(H[ooh][0] == '\0') return 0;
    i++;
  }
  return 0;
}
int insert(char str[]){
  int i = 0;
  long long tin;
  long long sum = getKey(str);
  while(1){
    tin = (h1(sum)+ i * h2(sum)) % N;
    if(H[tin][0] == '\0' || strcmp(H[tin],str) == 0){
      strcpy(H[tin], str);
      break;
    }
    i++;
  }
}
int main(){
  int i, total, h;
    char str[M], com[9];
    for ( i = 0; i < N; i++ ) H[i][0] = '\0';
    scanf("%d", &total);
    for ( i = 0; i < total; i++ ){
      scanf("%s %s", com, str);
      if ( com[0] == 'i' ){
        insert(str);
      } else {
        if (find(str)){
          printf("yes\n");
        } else {
          printf("no\n");
        }
 }
    }
    return 0;
}

