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

#define TABLE_SIZE 12

typedef struct _node {
	int val;
	struct _node *next;
} node;

void push(node **p, int val)
{
	node *w = (node *)malloc(sizeof(node));
	w->val = val;
	w->next = *p;
	*p = w;
}

void terminate(node **p, int n)
{
	int i;
	node *w1, *w2;

	for (i = 0; i < n; i++)
	{
		w1 = p[i];
		while (w1 != NULL)
		{
			w2 = w1->next;
			free(w1);
			w1 = w2;
		}	
	}
}

int getCode(char *s, int n)
{
	int code = 0;
	int i;
	for (i = 0; i < n; i++)
	{
		s[i] = s[i] & 0x06;
		s[i] = s[i] >> 1;
		code = code | s[i];
		code = code << 2;
	}
	code = code >> 2;
	return code;
}

int isInclude(node *p, char *str, int n)
{
	unsigned int mask = 0xFFFFFF >> (TABLE_SIZE * 2 - n * 2);
	int val = getCode(str, n) & mask;
	
	while (p != NULL)
	{
		if ((p->val & mask) == val) break;
		p = p->next;
	}
	if (p == NULL) return 0;
	return 1;
	
}

int main()
{
	int i, n, size;
	char str[TABLE_SIZE + 1], order[7];
	node *table[TABLE_SIZE];

	for (i = 0; i < 12; i++) table[i] = NULL;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%s%s", order, str);
		size = strlen(str);
		switch (order[0])
		{
		case 'i':
			push(&table[size-1], getCode(str,size));
			break;
		case 'f':
			if (isInclude(table[size-1], str, size)) printf("yes\n");
			else printf("no\n");
			break;
		}
	}

	terminate(table, TABLE_SIZE);

	return 0;
}