#include <stdio.h>          // printf(), fprintf(), scanf()

const char NUL = '\0';
unsigned char hash_t[1 << 22] = { 0 };
char key[256] = { 0 };

int
hash(const char* s)
{
	int u = 1;
	while (*s != NUL)
	{
		u = u * 4 + key[(int)*s];
		s++;
	}

	return u;
}

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

	key['A'] = 0;
	key['C'] = 1;
	key['G'] = 2;
	key['T'] = 3;

	scanf("%d", &n);
	while (n--)
	{
		scanf("%s %s", command, str);
		int h = hash(str);
		int u = h >> 3;
		int v = 1 << (h & 7);
		switch (command[0])
		{
		case 'i':
			hash_t[u] |= v;
			break;

		case 'f':
		default:
			if ((hash_t[u] & v) != 0)
				printf("yes\n");
			else
				printf("no\n");
			break;
		}
	}

	return 0;
}