#include <stdio.h>
#include <string.h>
#define M 1000000
#define L 15
#define NIL -1
char H[M][L]; 
int find(char str[]);
  
int Key(char str[]);
int hen(char ch);
int h1(int key);
int h2(int key);

int insert(char str[]);

 

int main() {
  int i, n;
  char r[L], c[9];
  for (i = 0; i < M; i++) H[i][0] = '\0';
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%s %s", c, r);
    if (c[0] == 'i') {
      insert(r);
    }
    else {
      if (find(r)) {
	printf("yes\n");
      }
      else {
	printf("no\n");
      }
    }
  }
  return 0;
}

int find(char str[]) {
  long long key, i = 0, h;
  key = Key(str);
  while (1) {
    h = (h1(key) + i * h2(key)) % M;
    i++;
    if (strcmp(H[h], str) == 0) return 1;
    else if (strlen(H[h]) == 0) return 0;
  }
  return 0;
}
int Key(char str[]) {
  int sum = 0, p = 1, i;
  for (i = 0; i < strlen(str); i++) {
    sum += p * (hen(str[i]));
    p *= 6;
  }	
  return sum;
} int hen(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;
}
int insert(char str[]) {
  long long key, i = 0, h;
  key = Key(str);
  while (1) {
    h = (h1(key) + i * h2(key)) % M;
    i++;
    if (strcmp(H[h], str) == 0) return 1;
    else if (strlen(H[h]) == 0) {
      strcpy(H[h], str);
      return 0;
    }
  }
  return 0;
}
int h1(int key) { return key % M ; }
int h2(int key) { return 1 + (key % (M - 1)); }
