// AOJ ALDS1_4_C Dictionary
// 2018.4.27 bal4u

#include <stdio.h>

// バッファを経ずstdinから数値を得る
#define gc() getchar_unlocked()
//#define gc() getchar()
int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

char tr['T'+1];
char f[268435460];

int trans()
{
	int c, k, w;

	w = k = 0; while ((c = gc()) >= ' ') {
		k = (k<<2) | tr[c], w++;
	}
	return w | (k<<4);
}

int main()
{
	int n, k;

	tr['A'] = 0, tr['C'] = 1, tr['G'] = 2, tr['T'] = 3;
	n = in();
	while (n--) {
		if (gc() == 'i') {
			k = 6; while (k--) gc();
			f[trans()] = 1;
		} else {
			k = 4; while (k--) gc();
			puts(f[trans()]? "yes": "no");
		}
	}
	return 0;
}

