#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) {
	int *record;
	int used = 0, num_cmd, i, key;
	char cmd[15], str[15];
	const char *result;

	scanf("%d ", &num_cmd);
	record = malloc(sizeof(int)*num_cmd);
	while (num_cmd--) {
		scanf("%s %s", cmd, str);
		key = get_key(str);
		if (cmd[0] == 'i') {
			record[used++] = key;
		} else {
			result = "no";
			for (i = 0; i < used; i++) {
				if (record[i] == key) {
					result = "yes";
					break;
				}
			}
			puts(result);
		}
	}
	return 0;
}