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

typedef struct Node* NodePointer;

struct Node {
  NodePointer next[5];
};

int conv(char c) {
  switch(c) {
  case '\0':return 0;
  case 'A': return 1;
  case 'C': return 2;
  case 'G': return 3;
  case 'T': return 4;
  }
  return -1;
}

NodePointer makeNode() {
  int i;
  NodePointer p;
  p = malloc(sizeof(struct Node));
  for(i = 0; i < 5; ++i) {
    p->next[i] = NULL;
  }
  return p;
}
    
void insert(NodePointer p, char* s) {
  int a;
  a = conv(*s);
  if(p->next[a] == NULL) p->next[a] = makeNode();
  if(a != 0) insert(p->next[a], s+1);
}

int find(NodePointer p, char* s) {
  int a;
  a = conv(*s);
  if(p->next[a] == NULL) return 0;
  if(a == 0) return 1;
  return find(p->next[a], s+1);
}

int main() {
  int n;
  char s[100], t[100];
  NodePointer head;

  head = makeNode();
  scanf("%d", &n);
  while(n--) {
    scanf("%s %s", s, t);
    if(s[0] == 'i') {
      insert(head,t);
    } else {
      if(find(head,t))
        printf("yes\n");
      else
        printf("no\n");
    }
  }
  return 0;
}