#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define mymalloc(p,n) {p = malloc((n)*sizeof(*p));if ((p)==NULL) {printf("not enough memory?\n"); exit(1);};}

typedef struct obj{
	struct obj **word;
	int isIn;
}words;

words *createObj(){
	int i;
	words *W;
	mymalloc(W,1);
	mymalloc(W->word,4);
	for(i=0;i<4;i++){
		W->word[i]=NULL;
	}
	W->isIn=0;
	return W;
}

int num(char w){
	if(w=='A'){
		return 0;
	}else{
	if(w=='T'){
		return 1;
	}else{
	if(w=='G'){
		return 2;
	}else{
	if(w=='C'){
		return 3;
	}}}}
}

void insert(words *W,char *key){
	int i,l;
	words *w;
	l=strlen(key);
	w=W;
	for(i=0;i<l;i++){
		if(w->word[num(key[i])]!=NULL){
			w=w->word[num(key[i])];
		}
		else{
			w->word[num(key[i])]=createObj();
			w=w->word[num(key[i])];
		}
	}
	w->isIn=1;
	
}

int find(words *W,char *key){
	int i,l;
	words *w;
	l=strlen(key);
	w=W;
	for(i=0;i<l;i++){
		if(w->word[num(key[i])]!=NULL){
			w=w->word[num(key[i])];
		}
		else{
			return 0;
		}
	}
	if(w->isIn==1){return 1;}
	else{return 0;}
}
		
main(){
	int i,n,mes;
	char com[7],str[14];
	words *W;
	W=createObj();
	scanf("%d ",&n);
	for(i=0;i<n;i++){
		scanf(" %s %s",com,str);
		if(strcmp(com,"find")==0){
			mes=find(W,str);
			if(mes==0){
				puts("no");
			}
			else{
				puts("yes");
			}
		}
		else{
			insert(W,str);
		}
	}
}