#include <stdio.h>
#include <string.h>

#define MAX 244140625

int Hash[MAX];
char str[13];

int getChar(char ch){
	if(ch == 'A') return 1;
	else if(ch == 'C') return 2;
	else if(ch == 'G') return 3;
	return 4;
};
int getKey(){
	int sum = 0, p = 1;
	for (int ix = 0 ; ix < strlen(str) ; ix++){
		sum += p*( getChar(str[ix]) );
		p *= 5;
	}
	return sum;
};
int find(){
	int key = getKey();
	if (Hash[key])
		return 1;
	return 0;
};
void insert(){
	Hash[getKey()] = 1;
};

int main(){
	int n;
	char com[7];
	scanf("%d\n",&n);
	while (n--){
		scanf("%s %s",com,str);
		if (com[0] == 'i') insert();
		else{
			if (find()) printf("yes\n");
			else printf("no\n");
		}
    }
	return 0;
}
