#include <stdio.h>
#include <string.h>
#define M 1500000
#define NIL -1
#define L 13

char A[M][L];

int getChar(char c) {
	if (c == 'A')return 1;
	else if (c == 'C')return 2;
	else if (c == 'G')return 3;
	else if (c == 'T')return 4;
	else return 0;
}

int getKey(char str[]) {
	int i, total = 0, p = 1;
	for (i = 0; i < strlen(str); i++) {
		total += p * (getChar(str[i]));
		p *= 5;
	}
	return total;

}

int h1(int key) {
	return key % M;
}
int h2(int key) {
	return 1 + (key % (M - 1));
}

int find(char str[]) {

	int key, h, i;
	key = getKey(str);
	i = 0;
	while (1) {
		h = (h1(key) + i * h2(key)) % M;
		if (strcmp(A[h], str) == 0)return 1;
		else if (strlen(A[h]) == 0)return 0;
		i++;
	}
	return 0;

}

int insert(char str[]) {


	int key, i, h;
	key = getKey(str);
	i = 0;
	while (1) {
		h = (h1(key) + i * h2(key)) % M;
		if (strcmp(A[h], str) == 0)return 1;
		else if (strlen(A[h]) == 0) {
			strcpy(A[h], str);
			return 0;

		}
		i++;
	}
	return 0;

}


int main() {
	int i, h, n;
	char str[L], com[9];
	for (i = 0; i < M; i++)A[i][0] = '\0';
	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%s %s", com, str);
		if (com[0] == 'i') {
			insert(str);
		}
		else {
			if (find(str)) {
				printf("yes\n");
			}
			else {
				printf("no\n");
			}
		}

	}

	return 0;
}
