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

#define M 1046527
#define L 14

char H[M][L];

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

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

int h(int key, int i) {
  return (h1(key) + i * h2(key)) % 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;
  else return 0;
}

int getKey(char str[]) {
  int sum = 0;
  int p = 1;
  for (int i = 0; i < strlen(str); i++) {
    sum += p * getChar(str[i]);
    p *= 5;
  }
  return sum;
}

void insert(char str[]) {
  int key;
  int hash;
  int i = 0;
  key = getKey(str);
  while(1) {
    hash = h(key, i++);
    if(strlen(H[hash]) == 0) {
      strcpy(H[hash], str);
      break;
    }
    else if(strcmp(H[hash], str) == 0)
      break;
  }
}

int find(char str[]) {
  int key;
  int hash;
  int i = 0;
  key = getKey(str);
  while(1) {
    hash = h(key, i++);
    if(strlen(H[hash]) == 0)
      return 0;
    else if (strcmp(H[hash], str) == 0)
      return 1;
  }
}

int main(void) {
  int n;
  char command[10];
  char word[L];

  for (int i = 0; i < n; i++)
    H[i][0] = '\0';
  
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", command);
    scanf("%s", word);
    if (command[0] == 'i')
      insert(word);
    else {
      if (find(word))
	printf("yes\n");
      else
	printf("no\n");
    }
  }

  return 0;
}

