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

#define N 250000000

int str[N];
int count = 0;

int getChar(char );

int main()
{
  long long p, sum;
  int i, j, n;
  char com[9], s[13];

  scanf("%d", &n);

  for( i = 0; i < n; i++)
    {
      scanf("%s%s",com,s);
      
	  sum = 0; p = 1;
	  str[count] = 0;
	  for( j = 0; j < strlen(s); j++)
	    {
	      sum += p*(getChar(s[j]));
	      p*=5;
	    }

	  if( com[0] == 'i')
	    {	  
	      str[sum] = 1;
	    }
	  else
	    {
	      if (str[sum]==1)printf("yes\n");
	      else printf("no\n");
	    }
    }
	  
      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;
  else return 0;
}

