#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define M 1000040
char c[20],a[20]; /* Hash Table */
int dic[1000040][20];

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  return 4;
}
int h1(int b){return b%M;}
int h2(int b){return 1+b%(M-1);}
int find(int x,int y,int sum,int ch){
  int i=1,h,j=0;
  if(x==strlen(a)){
    h=(h1(sum)+h2(sum))%M;
    if(!ch){
      if(dic[h][0]!=NULL){
	while(dic[h][i]!=NULL){
	  i++;
	}
	dic[h][i]=sum;
	return 0;
      }else{
	dic[h][0]=sum;
	return 0;
      }
    }
    while(dic[h][j]!=NULL && dic[h][j]!=sum){
      j++;
    }
    if(dic[h][j]==NULL) return 0;
    else return dic[h][j];
  }
  return find(x+1,y*4,sum+y*getChar(a[x]),ch);
}

int main(){
    int i,x,t, n, h;
    scanf("%d", &n);
    for ( i = 0; i < n; i++ ){
      scanf("%s %s", c, a);
      if ( c[0] == 'i' ){
	find(0,1,0,0);
      } else {
	if (find(0,1,0,1)>0){
	  printf("yes\n");
	} else {
	  printf("no\n");
	}
      }
    }

    return 0;
}

