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

#define	HASHTABLEMAX	16777216
#define	EXIST			1
#define	NONE			0

char hashTable[HASHTABLEMAX];

void init(void){
	unsigned int i;
	for( i=0; i<HASHTABLEMAX; i++){
		hashTable[i] = NONE;
	}
}

unsigned int makehash(char *str){
	unsigned int i;
	unsigned int hash;
	unsigned int code;
	
	i = 0;
	hash = 0;
	code = 0;
	while(str[i] != '\0'){
		hash <<= 2;
		switch(str[i]){
			case 'A':
				code = 0b00;
				break;
			case 'C':
				code = 0b01;
				break;
			case 'G':
				code = 0b10;
				break;
			case 'T':
				code = 0b11;
				break;
			default:
				break;
		}
		hash += code;
		i++;
	}
	i <<= 16;
	hash += i;
	return hash;
}

void find(unsigned int hash){
	if(hashTable[hash] == EXIST){
		printf("yes\n");
	}else{
		printf("no\n");
	}
}

void insert(unsigned int hash){
	hashTable[hash] = EXIST;
}

int main(void){
	unsigned int i;
	unsigned int n;
	unsigned int hash;
	unsigned int length;
	char command[7];
	char str[13];
	
	init();
	scanf("%d",&n);
	for( i=0; i<n; i++){
		scanf("%s",command);
		scanf("%s",str);
		hash = makehash(str);
		//printf("%d\n",hash);
		if(strcmp(command,"find") == 0){
			find(hash);
		}else if(strcmp(command,"insert") == 0){
			insert(hash);
		}else{
			;
		}
	}
}