
#include<stdio.h>

#include<string.h>
#define N 256

char array1[1<<21],arrayk[N];

int main(int argc,char *argv[]){
char cha;
int numf;

int numv,nums,numt;
  

arrayk['T'] = 1;
arrayk['G'] = 2;
  arrayk['C'] = 3;
  arrayk['A'] = 4;
   
  scanf("%d", &numv);

  getchar();

  while (numv--) {
    nums = 0;
    numt = 1;

    numf = ( cha = getchar() ) == 'i';

    while ( ( cha = getchar() ) != ' ' );

    while ( ( cha = arrayk[getchar()] ) != 0 ) {

      nums += cha * numt;

      numt *= 4;
    } 

    if (numf) array1[nums] = 1; 
else puts( array1[nums] ? "yes" : "no" );

  }

  return 0;
}