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

#define abs(a) (a > 0 ? a : -a )

#define M 1046527
#define L 14

char h[M][L];

long long makeKey(char *);
int hash1(int);
int hash2(int);
int hash(int, int, int);

int insert(char *);
int find(char *);

int main() {
  char command[9];
  char str[L];

  int n, key, h1, h2;
  int i, j;

  for (i = 0; i < M; i++) {
    h[i][0] = '\0';
  }

  scanf("%d", &n);

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

    if(command[0] == 'i') {
      insert(str);
    }
    else {
      if (find(str)) {
        printf("yes\n");
      } else {
        printf("no\n");
      }
    }
  }

  return 0;
}

int insert(char *str) {
  long long key, i, ha;
  key = makeKey(str);
  for (i = 0; ; i++) {
    ha = hash(hash1(key), hash2(key), i);
    if (strcmp(h[ha], str) == 0) return 1;
    else if (strlen(h[ha]) == 0) {
      strcpy(h[ha], str);
      return 0;
    }
  }
  return 0;
}

int find(char *str) {
  long long key, i, ha;
  key = makeKey(str);
  for (i = 0; ; i++) {
    ha = hash(hash1(key), hash2(key), i);
    if (strcmp(h[ha], str) == 0) return 1;
    else if (strlen(h[ha]) == 0) return 0;
  }
  return 0;
}

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

long long makeKey(char *s) {
  long long key = 0;
  int p = 1, j;

  j = 0;
  while (s[j] != '\0') {
    j++;
    key += getChar(s[j]) * p;
    p *= 5;
  }

  return key;
}

int hash(int h1, int h2, int i) {
  // printf(">>> %d\n", ((h1 + i) * h2) % M);
  return abs(((h1 + i) * h2) % M);
}

int hash1(int k) {
  return k % M;
}

int hash2(int k) {
  return 1 + (k % (M - 1));
}
