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

#define M 100000
#define L 14

char H[M][L];

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 = sum + p * (getChar(str[i]));
    p = p * 5;
  }
  return sum;
}

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

int find(char str[]) {
  int key, nextkey;
  key = h1(getkey(str));
  nextkey = h2(getkey(str));

  while(H[key][0] != NULL) {
    if(strcmp(H[key], str) == 0) {
      return 1;
    }
    else {
      key = key + nextkey;
    }
  }
  return 0;
}

int insert(char str[]) {
  int key, nextkey;
  key = h1(getkey(str));
  nextkey = h2(getkey(str));

  while(1) {
    if(H[key][0] == NULL || strcmp(H[key], str) == 0) {
      strcpy(H[key], str);
      break;
    }
    else {
      key = key + nextkey;
    }
  }
  return 1;
}

main() {
  int i, n, h;
  char str[L], com[9];

  scanf("%d", &n);

  for(i = 0; i < n; 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;
}