#include <stdio.h>
#include <stdlib.h>
#define STRLEN 12

typedef struct node{
  int exist;
  struct node *a;
  struct node *c;
  struct node *g;
  struct node *t;
}Node;

Node* create_node(){
  Node * node = ( Node * ) malloc ( sizeof( Node ) );
  node -> exist = 0;
  node -> a = NULL;
  node -> c = NULL;
  node -> g = NULL;
  node -> t = NULL;
  return node;
}

void insert( Node *node, char *str ){
  switch( str[ 0 ] ){
  case '\0':
    node -> exist = 1;
    return;
  case 'A':
    if( node -> a == NULL ) node -> a = create_node();
    insert( node -> a, str + 1 );
    return;
  case 'C':
    if( node -> c == NULL ) node -> c = create_node();
    insert( node -> c, str + 1 );
    return;
  case 'G':
    if( node -> g == NULL ) node -> g = create_node();
    insert( node -> g, str + 1 );
    return;
  case 'T':
    if( node -> t == NULL ) node -> t = create_node();
    insert( node -> t, str + 1 );
    return;
  }
  printf("error\n");
  return;
}


int find( Node * node, char *str ){
  if( node == NULL ) return 0;
  switch( str[0] ){
  case '\0':
    return node -> exist;
  case 'A':
    return find( node -> a, str + 1 );
  case 'C':
    return find( node -> c, str + 1 );
  case 'G':
    return find( node -> g, str + 1 );
  case 'T':
    return find( node -> t, str + 1 );
  }
  printf("error\n");
  return 0;
}

void kill( Node * node ){
  if( node == NULL ) return;
  if( node -> a != NULL ) kill( node -> a );
  if( node -> c != NULL ) kill( node -> c );
  if( node -> g != NULL ) kill( node -> g );
  if( node -> t != NULL ) kill( node -> t );
  free( node );
}


int main( void ){
  int n;
  scanf("%d\n", &n );
  char op[ 10 ], str[ STRLEN + 1 ];
  Node *head = create_node();
  for( int i = 0; i < n; i ++ ){
    scanf("%s %s", op, str );
    if( op[ 0 ] == 'i' )insert( head, str );
    else {
      if( find( head, str ) ) printf("yes\n", str );
      else printf("no\n", str);
    }
  }
  kill( head );
  return 0;
}
