// AOJ ALDS1_4_C Dictionary
// 2018.4.27 bal4u

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

// 数値のハッシュ関数
#define HASHSIZ 1500007
int hash[HASHSIZ+3], *hashend = hash+HASHSIZ;

int lookup(int n)
{
	int *p;
	
	n++; p = hash + n % HASHSIZ;
	while (*p) {
		if (*p == n) return 1;
		if (++p == hashend) p = hash;
	}
	return 0;
}

void insert(int n)
{
	int *p;
	
	n++; p = hash + n % HASHSIZ;
	while (*p) {
		if (*p == n) return;
		if (++p == hashend) p = hash;
	}
	*p = n;
}

char tr['T'+1];
char buf[20], *p;

int trans(char *p)
{
	int k;

	k = 0; while (*p >= ' ') {
		k = (k<<2) | tr[*p++];
	}
	return k;
}

int main()
{
	int n;

	tr['A'] = 0, tr['C'] = 1, tr['G'] = 2, tr['T'] = 3;
	fgets(buf, 10, stdin), n = atoi(buf);
	while (n--) {
		fgets(p=buf, 20, stdin);
		if (*p == 'i') insert(trans(p+7));
		else puts(lookup(trans(p+5))? "yes": "no");
	}
	return 0;
}

