#include <stdio.h>
#include <string.h>
 
#define MAX 1000000
 
int H[MAX];
char A[12];
 
int getChar(char);
int getKey();
int find();
void insert();
 
int main()
{
  int n;
  char C[7];
 
  scanf("%d" ,&n);

  while(n--)
  {
    scanf("%s %s" ,C,A);
 
    if(C[0] == 'i')insert();

    else
    {
      if(find())puts("yes");
      else puts("no");
    }
  }
 
  return 0;
}
 
int getChar(char C)
{
  if(C == 'A')return 1;
  else if(C == 'C')return 2;
  else if(C == 'G')return 3;

  return 4;
}
 
int getKey()
{
  int sum=0,p=1,i;
 
  for(i = 0;i < strlen(A);i++)
  {
    sum += p*(getChar(A[i]));
    p *= 5;
  }
  return sum;
}
 
int find()
{
  int key = getKey();
 
  if(H[key])return 1;
 
  return 0;
}
 
void insert()
{
  H[getKey()] = 1;
}