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

char hash[1<<21],Dictionary[256];

int main(int argc,char *argv[]){
  int flg;
  int valume,x,y;
  char c;

  Dictionary['T'] = 1;
  Dictionary['G'] = 2;
  Dictionary['C'] = 3;
  Dictionary['A'] = 4;

  scanf("%d",&valume);
  getchar();
  while(valume--){
    x = 0;
    y = 1;
    flg = (c = getchar()) == 'i';
    while((c = getchar()) != ' ');
    while((c = Dictionary[getchar()]) != 0){
      x += c * y;
      y *= 4;
    }
    if(flg) hash[x] = 1; else puts(hash[x] ? "yes" : "no");
  }
  return 0;
}

