#include<stdio.h>
#include<string.h>

#define MAX 14
#define N 1046527

char H[N][MAX];

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else  return 4;
}

long long getKey(char str[]){
  long long sum = 0, p = 1;
  int 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 Insert(char *word){
  long long key;
  int i,h;

  key=getKey(word);

  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%N;
    if(strcmp(H[h],word)==0)return 1;
    else if (strlen(H[h])==0){
      strcpy(H[h],word);
      return 0;
    }
  }
  return 0;
}

long long Find(char *word){
  long long key;
  int i,h;

  key=getKey(word);

  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%N;
    if(strcmp(H[h],word)==0)return 1;
    else if (strlen(H[h])==0)return 0;
  }
  return 0;
}

int main(){
  int n,i,flag;
  char order[10],words[12];

  for(i=0;i<N;i++){
    H[i][0]='\0';
  }

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s %s",order,words);

    if(strcmp(order,"insert")==0)
    Insert(words);

    else if(strcmp(order,"find")==0){
      flag=Find(words);

      if(flag==1)
      printf("yes\n");

      else
      printf("no\n");

    }

    else
    printf("miss order!!\n");


  }
  return 0;
}

