#include <stdio.h>
#include <stdlib.h>
#include <math.h>


#define	BUCKET_SIZE	1000000


typedef struct hash_t{
	char str[13];
	struct hash_t *next;
}HASH_T;


HASH_T *TABLE[BUCKET_SIZE];


void Init_table()
{
	int i;


	for(i = 0; i < BUCKET_SIZE; i++)
		TABLE[i] = NULL;
}


unsigned int Hash(char *str)
{
	int i;
	int num;
	unsigned int sum = 0;


	for(i = 0; i < strlen(str); i++){
		if(str[i] == 'A')
			num = 1;
		else if(str[i] == 'C')
			num = 2;
		else if(str[i] == 'G')
			num = 3;
		else if(str[i] == 'T')
			num = 4;
		sum += num * pow(6, i);
	}

	return sum % BUCKET_SIZE;
}


int Hash_find(char *str)
{
	HASH_T *p;


	for(p = TABLE[Hash(str)]; p != NULL; p = p->next){
		if(!strcmp(str, p->str))
			return 1;
	}

	return 0;
}


int Hash_insert(char *str)
{
	HASH_T *p;
	int h;


	if(Hash_find(str))
		return 0;

	if( (p = (HASH_T *)malloc(sizeof(HASH_T))) == NULL){
		printf("malloc error\n");
		exit(1);
	}

	h = Hash(str);
	strcpy(p->str, str);
	p->next = TABLE[h];
	TABLE[h] = p;

	return 1;
}


int main()
{
	char in_str[30];
	char command[10], str[20];
	int command_n;
	int i;


	fgets(in_str, sizeof(in_str), stdin);
	sscanf(in_str, "%d", &command_n);

	Init_table();

	for(i = 0; i < command_n; i++){
		fgets(in_str, sizeof(in_str), stdin);
		sscanf(in_str, "%s %s", command, str);

		if(command[0] == 'i')
			Hash_insert(str);
		else if(command[0] == 'f'){
			if(Hash_find(str))
				printf("yes\n");
			else
				printf("no\n");
		}
	}

	return 0;
}
