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

#define REG    ("insert")
#define FIND   ("find")
#define MAX_DT (1000000)
typedef struct  aaa{
	char 		chr[12];
	struct aaa	*next_p;
} CMD_T;

typedef struct {
	int			num;
	CMD_T		*ptr;
} CMD_CHAIN_T;

//CMD_T	cmd[MAX_DT];
CMD_CHAIN_T	a_cmd;
CMD_CHAIN_T	c_cmd;
CMD_CHAIN_T	g_cmd;
CMD_CHAIN_T	t_cmd;

/*-------------- SUN ROUTINE START -------------*/
void func_free(void)
{
	CMD_CHAIN_T	*wk_p;
	CMD_T		*cmd_p;
	CMD_T		*temp_p;
	int         i;

	for (i=0 ; i<4 ; i++) {
		switch (i) {
		case 0:
			wk_p = &a_cmd;
			break;
		case 1:
			wk_p = &c_cmd;
			break;
		case 2:
			wk_p = &g_cmd;
			break;
		case 3:
		default:
			wk_p = &t_cmd;
			break;
		}

		if (wk_p->ptr==NULL) {
			continue;
		}
		cmd_p = wk_p->ptr;
		while (cmd_p->next_p != NULL) {
			temp_p = cmd_p->next_p;
			free(cmd_p);
			cmd_p = temp_p;
		}
	}
}
CMD_CHAIN_T *func_ptrget(char *ptr)
{
	CMD_CHAIN_T *wk_p;

	switch (ptr[0]) {
	case 'A':
		wk_p = &a_cmd;
		break;
	case 'C':
		wk_p = &c_cmd;
		break;
	case 'G':
		wk_p = &g_cmd;
		break;
	case 'T':
	default:
		wk_p = &t_cmd;
		break;
	}

	return wk_p;
}


int func_reg(char *ptr)
{
	CMD_CHAIN_T *wk_p;
	CMD_T		*cmd_p;
	CMD_T		*ins_p;

	if ((ins_p = (CMD_T*)malloc(sizeof(*ins_p)))==0){
		return -1;
	}
	strcpy(&(ins_p->chr[0]),ptr);
	ins_p->next_p = NULL;

	wk_p = func_ptrget(ptr);
	cmd_p = wk_p->ptr;
	if (cmd_p != NULL) {
		while(cmd_p->next_p!=NULL) {
			cmd_p = cmd_p->next_p;
		}
		
		cmd_p->next_p = ins_p;
	}
	else {
		wk_p->ptr = ins_p;
	}
	return 0;
}

int func_find(char *ptr)
{
	CMD_CHAIN_T *wk_p;
	CMD_T		*cmd_p;
	int			flg;

	wk_p = func_ptrget(ptr);
	if (wk_p->ptr == NULL) {
		return 0;
	}
	cmd_p = wk_p->ptr;

	flg = 0;
	while(1) {
		if (strcmp(&(cmd_p->chr[0]),ptr)==0) {
			flg = 1;
			break;
		}
		if (cmd_p->next_p==NULL) {
			break;
		}
		cmd_p = cmd_p->next_p;
	}

	return flg;
}
/*-------------- SUN ROUTINE END -------------*/
int main()
{
	int 	n,i,rtn;
	char 	buff[96];
	char	op[12];
	char    chr[12];


	/** INIT **/
	a_cmd.num=0;
	a_cmd.ptr=NULL;
	c_cmd.num=0;
	c_cmd.ptr=NULL;
	g_cmd.num=0;
	g_cmd.ptr=NULL;
	t_cmd.num=0;
	t_cmd.ptr=NULL;

//	for (i=0 ; i<MAX_DT ; i++) {
//		cmd[i].op[0] = 0;
//		cmd[i].chr[0]= 0;
//		cmd[i].next_p= NULL;
//	}

	/** INPUT **/
	gets(buff);
	sscanf(buff,"%d",&n);

	for (i=0 ; i<n ; i++) {
		gets(buff);
		sscanf(buff,"%s %s",&op,&chr);

		if (strcmp(op,REG)==0) {
			rtn = func_reg(chr);
		}
		else {
			if (strcmp(op,FIND)==0) {
				rtn = func_find(chr);
				if (rtn==0) {
					printf("no\n");
				}
				else {
					printf("yes\n");
				}
			}
			else {
				;
			}
		}

	}
	func_free();
	return 0;
}