#include <stdio.h>          // printf(), fprintf(), scanf()
#include <stdlib.h>         // exit()
#include <string.h>         // strlen(), strcpy(), strcmp(), memset()
#include <stdbool.h>

// #define DEBUG 1
#define N_DICT 1000000
#define N_HASH 512000
#define L_STRINGS 50000000

typedef struct dict_tbl
{
	const char* str;
	int next;
} dict_t;

const char NUL = '\0';
int lineno;
dict_t dict[N_DICT];
char k[256];
int s_hash[N_HASH];
char strings[L_STRINGS];
int n_dict;
int ix;
int l_max;

void
cleanup(int ecode)
{
	exit(ecode);
}

int
hash(const char* str)
{
	int h;
	int i;

	h = 0;
	for (i = 0; str[i] != NUL; ++i)
		h = h * 4 + k[(int)str[i]];

	return h % N_HASH;
}

void
insert(const char* str)
{
	int u;

	if (n_dict >= N_DICT)
	{
		fprintf(stderr, "line %d: Dictionary area overflow. size:%d\n", lineno, N_DICT);
		cleanup(1);
	}

	if (ix + strlen(str) + 1 > L_STRINGS)
	{
		fprintf(stderr, "line %d: Strings area overflow. size:%d\n", lineno, L_STRINGS);
		cleanup(1);
	}

	char* s = &strings[ix];
	strcpy(s, str);
	ix += strlen(str) + 1;

	int h = hash(s);
	dict[n_dict].str = s;
	dict[n_dict].next = s_hash[h];

	s_hash[h] = n_dict;
	n_dict++;

	int i = 0;
	for (u = s_hash[h]; u != -1; u = dict[u].next)
		i++;

	if (i > l_max)
		l_max = i;
}

bool
find(const char* str)
{
	int u;

	u = s_hash[hash(str)];
	for (; u != -1; u = dict[u].next)
	{
		if (strcmp(str, dict[u].str) == 0)
			return true;
	}

	return false;
}

void
init()
{
	int i;

	for (i = 0; i < N_HASH; ++i)
		s_hash[i] = -1;

	memset(k, 0x00, sizeof(k));
	k['A'] = 1;
	k['C'] = 2;
	k['G'] = 3;
	k['T'] = 4;

	lineno = 0;
	n_dict = 0;
	ix = 0;
	l_max = 0;
}

int
main(int argc, char** argv)
{
	char command[8];
	char str[14];
	int n = 0;
	int i;

	init();
	scanf("%d", &n);
	for (i = 0; i < n; ++i)
	{
		lineno++;
		scanf("%s %s", command, str);
		switch (command[0])
		{
		case 'i':
			insert(str);
			break;

		case 'f':
		default:
			printf("%s\n", find(str) ? "yes" : "no");
			break;
		}
	}

#ifdef DEBUG
	int count = 0;
	for (i = 0; i < N_HASH; ++i)
	{
		if (s_hash[i] == -1)
			count++;
	}

	fprintf(stderr, "n_dict:%d ix:%d l_max:%d count:%d\n", n_dict, ix, l_max, count);
#endif
	return 0;
}