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

int hash(const char *word)
{
	int code = 0;
	while(*word)
	{
		code <<= 2;
		switch(*word)
		{
			case 'A': code |= 0; break;
			case 'C': code |= 1; break;
			case 'G': code |= 2; break;
			case 'T': code |= 3; break;
		}
		++word;
	}
	return code;
}


int main()
{
	int n, p = 1;
	char *dic[12], cmd[8], word[16];
	
	for(int i = 0; i < 12; ++i)
	{
		p *= 4;
		dic[i] = malloc(p * sizeof(char));
		for(int j = 0; j < p; ++j)
		{
			dic[i][j] = 0;
		}
	}
	
	scanf("%d", &n);
	for(int i = 0; i < n; ++i)
	{
		scanf("%s %s", cmd, word);
		if(strcmp(cmd, "insert") == 0)
		{
			dic[strlen(word)-1][hash(word)] = 1;
		}
		if(strcmp(cmd, "find") == 0)
		{
			printf(dic[strlen(word)-1][hash(word)] ? "yes\n" : "no\n");
		}
	}
	
	for(int i = 0; i < 12; ++i)
	{
		free(dic[i]);
	}
}

