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

typedef struct _node
{
	struct _node * next;
	char str[13];
} node_t;

node_t * str_A;
node_t * str_T;
node_t * str_C;
node_t * str_G;

void listinit()
{
	str_A = malloc( sizeof( node_t ) );
	str_T = malloc( sizeof( node_t ) );
	str_C = malloc( sizeof( node_t ) );
	str_G = malloc( sizeof( node_t ) );

	str_A->next = NULL;
	strcpy( str_A->str, "first" );
	str_T->next = NULL;
	strcpy( str_T->str, "first" );
	str_C->next = NULL;
	strcpy( str_C->str, "first" );
	str_G->next = NULL;
	strcpy( str_G->str, "fisrt" );
}

void listinsert( node_t * pointer, char * inputstr )
{
	node_t * newnode;
	node_t * tmp;

	newnode = malloc( sizeof( node_t ) );
	tmp = pointer;

	while ( tmp->next != NULL )
	{
		tmp = tmp->next;
	}

	tmp->next = newnode;
	strcpy( newnode->str, inputstr );
	newnode->next = NULL;
}

int listsearch( node_t * pointer, char * search_word )
{
	node_t * tmp;
	tmp = pointer;

	//	fprintf( stdout, "pointer word:%s\n", tmp->str );
	while( tmp != NULL )
	{
		if ( strcmp( tmp->str, search_word ) == 0 )
		{
			return 1;
		}
		tmp = tmp->next;
	}

	return 0;
}

void printvalue( node_t * pointer )
{
	node_t * tmp;

	tmp = pointer;
	while( tmp != NULL )
	{
		fprintf( stdout, "%s\n", tmp->str );
		tmp = tmp->next;
	}
}

int main()
{
	int n = 0, i = 0, flag = 0;
	char ope[8];
	char tmp_str[13];

	listinit();
	scanf( "%d", &n );
	while ( i < n )
	{
		scanf( "%s", ope );
		scanf( "%s", tmp_str );
		if ( strcmp( "insert", ope ) == 0 )
		{
			if ( tmp_str[0] == 'A' )
			{
				listinsert( str_A, tmp_str );
			}
			else if ( tmp_str[0] == 'T' )
			{
				listinsert( str_T, tmp_str );
			}
			else if ( tmp_str[0] == 'C' )
			{
				listinsert( str_C, tmp_str );
			}
			else if ( tmp_str[0] == 'G' )
			{
				listinsert( str_G, tmp_str );
			}
		}
		else if ( strcmp( "find", ope ) == 0 )
		{
			if ( tmp_str[0] == 'A' )
			{
				flag = listsearch( str_A, tmp_str );
			}
			else if ( tmp_str[0] == 'T' )
			{
				flag = listsearch( str_T, tmp_str );
			}
			else if ( tmp_str[0] == 'C' )
			{
				flag = listsearch( str_C, tmp_str );
			}
			else if ( tmp_str[0] == 'G' )
			{
				flag = listsearch( str_G, tmp_str );
			}


			if ( flag == 0 )
			{
				fprintf( stdout, "no\n" );
			}
			else if ( flag == 1 )
			{
				fprintf( stdout, "yes\n" );
			}
		}
//		printvalue( str_A );
		i = i + 1;
		memset( ope, 0, sizeof( ope ) );
		memset( tmp_str, 0, sizeof( tmp_str ) );
	}

	return 0;
}