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

#define MAX 1000000
int T[4][MAX + 5];
int convert(char[], int*);
int hashSearch(int, int);
int hashInsert(int, int);
int hash(int, int);

int main()
{
	int n;
	int i, ix;
	int count = 0;
	int store, find;

	scanf("%d", &n);
	char tempCmd[13];
	char tempChar[13];

	for (i = 0; i < n; i++) {
		scanf("%s %s", tempCmd, tempChar);
		if (tempCmd[0] == 'i') {
			store = convert(tempChar, &ix);
			if (hashInsert(store, ix) != -1) count++;
		}
		if (tempCmd[0] == 'f') {
			find = convert(tempChar, &ix);
			(hashSearch(find, ix) == -1) ? printf("no\n") : printf("yes\n");
		}
	}
	return 0;
}

int convert(char source[], int *ix) {
	int i;
	int value = 0;
	int p = 1;

	for (i = 0; i < strlen(source); i++) {
		int coef = 0;
		switch (source[i]) {
		case 'A': coef = 1;
			break;
		case 'T': coef = 2;
			break;
		case 'C': coef = 3;
			break;
		case 'G': coef = 4;
			break;
		}
		if (i == strlen(source) - 1) *ix = coef - 1;
		value += coef * p;
		p *= 5;
	}
	return value;
}

int hashInsert(int k, int row) {
	int i = 0;
	while (1) {
		int hashKey = hash(k, i);
		if (T[row][hashKey] == 0) {
			T[row][hashKey] = k;
			return hashKey;
		}
		i++;
	}
	return -1;
}

int hashSearch(int k, int row) {
	int i = 0;
	while (1) {
		int hashKey = hash(k, i);
		if (T[row][hashKey] == k) return hashKey;
		if (T[row][hashKey] == 0 || i >= MAX) return -1;
		i++;
	}
	return -1;
}

int hash(int k, int i) {
	int hash1 = k % MAX;
	int hash2 = 1 + k % (MAX - 1);
	int ans = ((hash1 + i * hash2) % MAX);
	if (ans < 0) ans *= -1;
	return ans;
}




