#include <stdio.h>
#include <string.h>
#define MAX 2000005

int d[MAX];
char s[15], inst[15];

int getC(char a) {
  if(a=='A') return 1;
   if(a=='C') return 2;
   if(a=='G') return 3;
   return 4;
}

int getPos(){
	int count=0, pos=1, i;
    
    for(i=0; i<strlen(s); i++){
        count += pos*(getC(s[i]));
        //printf("%d",count);
        pos *= 5;
    }
    
    return count;
}

void insert(){
    d[getPos()] = 1;
}

int find(int w, int x, int y, int z) {
    if(w == strlen(s)){
        if(z==0)
            d[x] = 1;
        return d[x];
    } 
    
    return find(w+1,x+getC(s[w])*y,y*4,z);
}

int main() {
  int n;
  
  scanf("%d",&n);
  while(n--) {
    scanf("%s %s",inst ,s);
    
    if(inst[0]=='i') 
        find(0,0,1,0);
    else {
      if(find(0,0,1,1))
        printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}

