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

#define BUF_SIZE 25
#define BITMAP_SIZE 33554432

int map[0xff] = {
  ['A'] = 0,
  ['C'] = 1,
  ['G'] = 2,
  ['T'] = 3,
};

int strtokey(char *str) {
  char *tmp;
  int i;
  int ans = strlen(str);
  // lsb 4bit: length, [31,5] -> key
  for(tmp = str, i=2; *tmp != '\0' && *tmp != '\n'; tmp++, i++) {
    ans |= (map[*tmp] << (i*2));
  }
  return ans;
}

#define CHAR_BITS (sizeof(char)*8)
#define CHAR_MASK (CHAR_BITS-1)
#define IDX(key) (key>>3)
#define VAL(key) (1 << (key&CHAR_MASK))

void insert(char *bitmap, char *str) {
  int key = strtokey(str);
  bitmap[IDX(key)] |= VAL(key);
}

int find(char *bitmap, char *str) {
  int key = strtokey(str);
  return !!(bitmap[IDX(key)] & VAL(key));
}

int main(void) {
  FILE *fp = stdin;
  char line[BUF_SIZE];

  if(!fgets(line, BUF_SIZE, fp)) return 0;
  int queries;
  sscanf(line, "%d", &queries);

  // array size: 2bit*12+4bit-3bit
  static char bitmap[BITMAP_SIZE] = {0};

  int i;
  char flag;
  for(i = 0; i < queries; i++) {
    if(!fgets(line, BUF_SIZE, fp)) return 0;
    char command[10];
    char str[14];
    sscanf(line, "%s %s", command, str);
    switch(*command) {
      case 'i': // insert
        insert(bitmap, str);
        break;
      case 'f':
        flag = find(bitmap, str);
        printf("%s\n", flag ? "yes" : "no");
        break;
      default:
        break;
    }
  }
}
