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

// プロセスの構造体
typedef struct {
  char command[10];
  char name[12];
} P;

// 辞書の構造体
typedef struct {
  char word[12];
} D;

D d[1000000];
int idx = 0;

void name_insert(char *target) {
  strcpy(d[idx].word, target);
  idx++;
}

int name_search(char *target) {
  int check = 0;
  for (int i = 0; i < idx; i++) {
    if (strcmp(target, d[i].word) == 0) {
      check = 1;
      break;
    }
  }
  return check;
}

int main() {
  int n;
  scanf("%d\n", &n);
  P p[n];
  for (int i = 0; i < n; i++) {
    scanf("%s", p[i].command);
    scanf("%s", p[i].name);
  }
  for (int i = 0; i < n; i++) {
    if (strcmp(p[i].command, "insert") == 0) {
      name_insert(p[i].name);
    } else {
      if (name_search(p[i].name)) {
        printf("%s\n", "yes");
      } else {
        printf("%s\n", "no");
      }
    }
  }
  return 0;
}

