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

struct node {
  char value;

  struct node *child[5];
};

struct node tree;

void insert(char *str);
void find(char *str);
int id(char c);

int main(int argc, char *argv[])
{
  char cmd[6 + 1];
  char str[12 + 1];
  int n, i;

  for (i = 0; i < 5; i++) tree.child[i] = NULL;

  scanf("%d", &n);

  for (i = 0; i < n; i++) {
    scanf("%s", cmd);
    if (!strcmp(cmd, "insert")) {
      scanf("%s", str);
      insert(str);
    } else if (!strcmp(cmd, "find")) {
      scanf("%s", str);
      find(str);
    }
  }

  return 0;
}

void insert(char *str)
{
  int i, j;
  struct node *current = &tree, *prev;

  for (i = 0; i <= strlen(str); i++) {
    prev = current;
    current = current->child[id(str[i])];

    if (current == NULL) {
      current = (struct node *)malloc(sizeof(struct node));
      current->value = str[i];
      for (j = 0; j < 5; j++) current->child[j] = NULL;
      prev->child[id(str[i])] = current;
    }
  }
}

void find(char *str)
{
  int i;
  struct node *p = &tree;

  for (i = 0; i <= strlen(str); i++) {
    if (p->child[id(str[i])] == NULL) {
      printf("no\n");
      return;
    } else p = p->child[id(str[i])];
  }
  printf("yes\n");
  return;
}

int id(char c)
{
  switch (c) {
  case '\0':
    return 0;

  case 'A':
    return 1;

  case 'C':
    return 2;

  case 'G':
    return 3;

  case 'T':
    return 4;

  default:
    return -1;
  }
}