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

#define MAX 200000000


int getChar(char a);
int searchKey();
int find();
void insert();
int M[MAX];
char string[15];

int main(){
  int size;
  char com[7];
  scanf("%d" ,&size);
  
  while(size--)
  {
    scanf("%s %s" ,com ,string);

    if(com[0] == 'i')
    {
      insert();
    }
    else
    {
      if(find())
      {
	printf("yes\n");
      }
      else
      {
	printf("no\n");
      }
    }
  }

  return 0;
}

int getChar(char a){
  if(a == 'A')
  {
    return 1;
  }
  else if(a == 'C')
  {
    return 2;
  }
  else if(a == 'G')
  {
    return 3;
  }
  return 4;
}

int searchKey()
{
  int sum = 0;
  int p = 1;
  for(int i = 0 ; i < strlen(string) ; i++)
  {
    sum += p*(getChar(string[i]));
    p *=5;
  }
  return sum;
}

int find()
{
  int key = searchKey();

  if(M[key]){
    return 1;
  }

  return 0;
}

void insert(){
  M[searchKey()] = 1;
}

