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

#define MAX_COMMAND_NUM 1000000
#define MAX_STR_LEN     12

#define OFF             0
#define ON              1

#define STR_TYPE_A      1
#define STR_TYPE_C      2
#define STR_TYPE_G      3
#define STR_TYPE_T      4


typedef struct ST_DICTIONARY_TREE DictionaryTree_t;

typedef struct ST_DICTIONARY_TREE{
	DictionaryTree_t *str_a;
	DictionaryTree_t *str_c;
	DictionaryTree_t *str_g;
	DictionaryTree_t *str_t;
	int    exist_flag;
} DICTIONARY_TREE;

static void setNullPointer(DictionaryTree_t **pptDictionary);
static void InsertProcess(DictionaryTree_t **ptDictionary, char *str);
static void FindProcess(DictionaryTree_t **ptDictionary, char *str);
static void setInsertPointer(DictionaryTree_t **pptDictionary);
static void allFreeProcess(DictionaryTree_t **pptDictionary);


int main(void)
{
	int command_num;
	char command[8];									/* command name */
	char str[MAX_STR_LEN] = {0};						/* string data */
	int loop = 0;
	DictionaryTree_t top_contents;
	DictionaryTree_t *dictionary = &top_contents;
	
	setNullPointer(&dictionary);
	
	scanf("%d", &command_num);
	
	if(command_num <= MAX_COMMAND_NUM)
	{
		while(((scanf("%s %s", command, str)) != EOF) && (loop < command_num))
		{
			if(command[0] == 'i')					/* Insert Porcess */
			{
				InsertProcess(&dictionary, str);
			}
			else if(command[0] == 'f')				/* Find Process */
			{
				FindProcess(&dictionary, str);
			}
			dictionary = &top_contents;				 /* back to Dictionary top */
			loop++;
			
			memset(str, '\0', MAX_STR_LEN);
		}
	}
	else
	{
		/* error command num */
	}
	
	allFreeProcess(&dictionary);

    return 0;
}

static void setNullPointer(DictionaryTree_t **pptDictionary)
{
	(*pptDictionary)->str_a = NULL;
	(*pptDictionary)->str_c = NULL;
	(*pptDictionary)->str_g = NULL;
	(*pptDictionary)->str_t = NULL;
	(*pptDictionary)->exist_flag = OFF;
}

static void setInsertPointer(DictionaryTree_t **pptDictionary)
{
	DictionaryTree_t *ptDictionaryPoint;
	
	/* make Insert pointer */
	ptDictionaryPoint = (DictionaryTree_t *)malloc(sizeof(DictionaryTree_t));
	setNullPointer(&ptDictionaryPoint);
	
	(*pptDictionary) = ptDictionaryPoint;
}

static void InsertProcess(DictionaryTree_t **ptDictionary, char *str)
{
	int str_point = 0;
	DictionaryTree_t *ptDictionaryPoint = (*ptDictionary);
	
	while(str_point < MAX_STR_LEN)
	{
		if(ptDictionaryPoint == NULL)				/* this line is not True */
		{
			setInsertPointer(&ptDictionaryPoint);
			continue;
		}
		else if(str[str_point] == '\0')
		{
			ptDictionaryPoint->exist_flag = ON;		/* exist flag ON */
			break;									/* insert finish */
		}
		else
		{
			if(str[str_point] == 'A')
			{
				if(ptDictionaryPoint->str_a == NULL)
				{
					setInsertPointer(&(ptDictionaryPoint->str_a));	/* Insert Dictionary Point */
				}
				else
				{
					/* nothing */
				}
				ptDictionaryPoint = ptDictionaryPoint->str_a;		/* move Dictionary point */
			}
			else if(str[str_point] == 'C')
			{
				if(ptDictionaryPoint->str_c == NULL)
				{
					setInsertPointer(&(ptDictionaryPoint->str_c));	/* Insert Dictionary Point */
				}
				else
				{
					/* nothing */
				}
				ptDictionaryPoint = ptDictionaryPoint->str_c;		/* move Dictionary point */
			}
			else if(str[str_point] == 'G')
			{
				if(ptDictionaryPoint->str_g == NULL)
				{
					setInsertPointer(&(ptDictionaryPoint->str_g));	/* Insert Dictionary Point */
				}
				else
				{
					/* nothing */
				}
				ptDictionaryPoint = ptDictionaryPoint->str_g;		/* move Dictionary point */
			}
			else if(str[str_point] == 'T')
			{
				if(ptDictionaryPoint->str_t == NULL)
				{
					setInsertPointer(&(ptDictionaryPoint->str_t));	/* Insert Dictionary Point */
				}
				else
				{
					/* nothing */
				}
				ptDictionaryPoint = ptDictionaryPoint->str_t;		/* move Dictionary point */
			}
			else
			{
				/* error input */
				break;
			}
		}
		str_point++;
	}
}

static void FindProcess(DictionaryTree_t **ptDictionary, char *str)
{
	int str_point = 0;
	int find_flag = OFF;
	
	DictionaryTree_t *ptDictionaryPoint = (*ptDictionary);
	
	while(str_point < MAX_STR_LEN)
	{
		if(ptDictionaryPoint == NULL)
		{
			/* Not Find Dicitionary Point */
			break;
		}
		else if(str[str_point] == '\0')
		{
			if(ptDictionaryPoint->exist_flag == ON)						/* If Exist Dicitionary Strings */
			{
				/* Find Dictionary Strings */
				find_flag = ON;
			}
			else
			{
				/* Not Exist Dicitionary Strings */
			}
			break;
		}
		else
		{
			if(str[str_point] == 'A')
			{
				if(ptDictionaryPoint->str_a == NULL)
				{
					/* Not Find Dicitionary Point */
					break;
				}
				else
				{
					ptDictionaryPoint = ptDictionaryPoint->str_a;		/* move Dictionary point */
				}
			}
			else if(str[str_point] == 'C')
			{
				if(ptDictionaryPoint->str_c == NULL)
				{
					/* Not Find Dicitionary Point */
					break;
				}
				else
				{
					ptDictionaryPoint = ptDictionaryPoint->str_c;		/* move Dictionary point */
				}
			}
			else if(str[str_point] == 'G')
			{
				if(ptDictionaryPoint->str_g == NULL)
				{
					/* Not Find Dicitionary Point */
					break;
				}
				else
				{
					ptDictionaryPoint = ptDictionaryPoint->str_g;		/* move Dictionary point */
				}
			}
			else if(str[str_point] == 'T')
			{
				if(ptDictionaryPoint->str_t == NULL)
				{
					/* Not Find Dicitionary Point */
					break;
				}
				else
				{
					ptDictionaryPoint = ptDictionaryPoint->str_t;		/* move Dictionary point */
				}
			}
			else
			{
				/* error input */
				break;
			}
		}
		str_point++;
	}
	if(find_flag == ON)
	{
		printf("yes\n");
	}
	else
	{
		printf("no\n");
	}
}

static void allFreeProcess(DictionaryTree_t **pptDictionary)
{
}


