#include <stdio.h>
#include <stdlib.h>
int get_key(char str[15]) {
	static int code['T'+1] = {['A']=1, ['C']=2, ['G']=3, ['T']=4};
	int i, s = 0, p = 1;

	for (i = 0; str[i] != '\0'; i++) {
		s += p * code[(int)str[i]];
		p *= 5;
	}
	return s;
}

int main(void) {
#if 0
	char hash[244140625] = {0};
#endif 
	char *hash;
	int num_cmd, i, key;
	char cmd[15], str[15];

	scanf("%d ", &num_cmd);
#if 1
	hash = malloc(sizeof(char)*244140625);
	for (i = 0; i < 244140625; i++) {
		hash[i] = 0;
	}
#endif
	while (num_cmd--) {
		scanf("%s %s", cmd, str);
		key = get_key(str);
		if (cmd[0] == 'i') {
			hash[key] = 1;
		} else {
			puts(hash[key] ? "yes" : "no");
		}
	}
	return 0;
}