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

/* Macro definition */
#define M 1000151        // M is prime number larger than 1,000,000

/* Prototype declaration */
int getKey(char *);
int h1(int);
int h2(int);
int hashf(int, int);
void hashInsert(char *);
int hashSearch(char *);

/* Global variable */
char T[M][13];

int main (){
  int i, n;
  char command[7], str[13];

  /* Input, Process and Output */
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) {
    scanf("%s %s", command, str);
    if( strcmp(command, "insert") == 0 ) hashInsert(str);
    else {
      if( hashSearch(str) ) printf("yes\n");
      else printf("no\n");
    }
  }
  
  return 0;
}

//Get key from string
int getKey(char *c) {
  if( c[0] == 'A' ) return 1;
  else if( c[0] == 'C' ) return 2;
  else if( c[0] == 'G' ) return 3;
  else if( c[0] == 'T' ) return 4;
  else return 0;
}

//Get hash value
int h1(int key) {
  return key % M;
}
int h2(int key) {
  return 1 + (key % (M - 1));
}
int hashf(int key, int i) {
  return (h1(key) + i * h2(key)) % M;
}

//Insert into array T
void hashInsert(char *str) {
  int i = 0, j;
  int key;
  key = getKey(str);
  while ( 1 ) {
    j = hashf(key, i);
    if ( strlen(T[j]) == 0 ) {
      strcpy(T[j], str);
      break;
    }else i++;
   }
  
}

//Search for key from array T
int hashSearch(char *str) {
  int i = 0, j;
  int key;
  key = getKey(str);
  while ( 1 ) {
    j = hashf(key, i);
    if ( strcmp(T[j], str) == 0 ) return 1;
    else if ( strlen(T[j]) == 0 ) break;
    else i++;
  }

  return 0;
}