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

static inline uint32_t
decode(char *s)
{
	const int p = 4;
	int i;
	uint32_t res = 0;

	for (i = 0; i <= 12; i++)
		switch (*s++) {
		case 'A':
			break;
		case 'C':
			res |= 1 << (i * 2 + p);
			break;
		case 'G':
			res |= 2 << (i * 2 + p);
			break;
		case 'T':
			res |= 3 << (i * 2 + p);
			break;
		case '\0':
		default:
			goto end;
		}

end:
	return res | i;
}

int
main(int argc, char **argv)
{
	int i, j, n, m;
	uint32_t *d;
	char cmd[16];
	char name[16];
	const int dlen = (1<<28)/8;

	scanf("%d", &n);
	if (n <= 0)
		return 1;

	d = (uint32_t *)malloc(dlen);
	if (d == NULL)
		return 1;
	memset(d, 0, dlen);

	for (i = m = 0; i < n; i++) {
		scanf("%s", cmd);
		if (cmd[0] == 'i') {
			uint32_t v;
			scanf("%s", name);
			v = decode(name);
			d[v/32] |= 1 << (v%32);
		} else if (cmd[0] == 'f') {
			uint32_t v;
			scanf("%s", name);
			v = decode(name);
			printf("%s\n", (d[v/32] & (1 << (v%32))) ? "yes" : "no");
		}
	}

	return 0;
}

