#include<stdio.h>
#include<string.h>
#define COMLEN 7
#define STRLEN 13
#define FOUND 1
#define NOT_FOUND 0
#define M 2000000

void insert(char *);
int find(char *);
int h1(long long);
int h2(long long);
int H(long long, int);
long long generate(char *);

char D[M][13] = {};

int main(){
  int n;
  int i;
  char com[COMLEN], str[STRLEN];

  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%s %s", com, str);
    //printf("Debug\n");
    if(com[0] == 'i') insert(str);
    else{
      if(find(str) == FOUND) printf("yes\n");
      else printf("no\n");
    }
  }
  
  return 0;
}

void insert(char *str){
  int i = 0, index;
  while(1){
    if(find(str) == FOUND) return;
    //printf("Debug\n");
    index = H(generate(str), i);
    //printf("Debug\n");
    if(strlen(D[index]) == 0){
      strcpy(D[index], str);
      return;
    }
    else i++;
  }
}

int find(char *str){
  int i = 0, index;
  while(1){
    index = H(generate(str), i);
    //printf("%d\n", index);
    if(strcmp(D[index], str) == 0){
      //printf("Debug1\n");
      return FOUND;
    }
    else if(strlen(D[index]) == 0){
      //printf("Debug2\n");
      return NOT_FOUND;
    }
    else i++;
  }
  return NOT_FOUND;
}

int h1(long long key){
  return key % M;
}

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

int H(long long key, int i){
  return (h1(key) + i * h2(key)) % M;
}

long long generate(char *str){
  int l, x;
  int i;
  long long key = 0, y = 1;
  
  l = strlen(str);
  for(i=0;i<l;i++){
    if(str[i] == 'A') x = 1;
    else if(str[i] == 'C') x = 2;
    else if(str[i] == 'G') x = 3;
    else if(str[i] == 'T') x = 4;
    key += x * y;
    y *= 10;
    //printf("%lld\n", key);
  }

  //printf("%lld\n", key);
  return key;
}

