// 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;
}

int  tr['T'+1];
char f[33554432];

int main()
{
	int n, k, c;

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

