//課題4-C 16D8102014J Kazuto Iguchi 5/14
//C
#include<stdio.h> 
#include<string.h>
#define N 256
 
char a[1<<21],b[N]; 
int main(int argc,char *argv[]){
  char ch;
  int f; 
  int v,s,t;
  
  b['T'] = 1;
  b['G'] = 2;
  b['C'] = 3;
  b['A'] = 4;
  
  scanf("%d", &v);
  
  getchar();

  while(v--){
    s=0;
    t=1;
    
    f=(ch=getchar())=='i';
    
    while((ch=getchar())!=' ');
    
    while((ch=b[getchar()])!=0){
      
      s+=ch*t; 
      t*=4;
    }
    
    if(f)a[s]=1;
    else puts(a[s]?"yes":"no");
  }
  
  return 0;
}

