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

#define M 1000211 /* your task*/
#define L 14
 
char H[M][L]; /* Hash Table */

int getChar(char);
long long getKey(char *);
int Hash1(int);
int Hash2(int);
void find(char *);
void IN(char *);

int main()
{
  int i, n, h;
  char str[L], com[9];
  for ( i = 0; i < M; i++ ) H[i][0] = '\0';
  
  scanf("%d", &n);
  
  for ( i = 0; i < n; i++ )
    {
      scanf("%s %s", com, str);
      
      if ( com[0] == 'i' )
	{
	  IN(str);
	}
      else
	{
	  find(str);
	}
    }
  
  return 0;
}

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

/* convert a string into an integer value */
long long getKey(char str[])
{
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ )
    {
      sum += p*(getChar(str[i]));
      p *= 5;
    }
  return sum;
}

int Hash1(int K)
{
  return K%M;
}

int Hash2(int K)
{
  return 1+(K%(M-1));
}

void find(char str[])
{
  long long K;
  int hash,i=0;
  K=getKey(str);
  
  while(1)
    {
      hash=( (Hash1(K)) + i*(Hash2(K)) )%M;
      if(strcmp(H[hash],str)==0)
	{
	  printf("yes\n");
	  break;
	}
      else if(strlen(H[hash])==0)
	{
	  printf("no\n");
	  break;
	}
      i++;
    }
}

void IN(char str[])
{
  long long K;
  int hash,i=0;
  K=getKey(str);
  
  while(1)
    {
      hash=( (Hash1(K)) + i*(Hash2(K)) )%M;
      if(H[hash][0]=='\0')break;
      i++;
    }
  
  strcpy(H[hash],str);
}

