#define MaxSize 524288
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>


void insert(unsigned int *D, unsigned int a) {
	unsigned int bitP = a % 32u;
	unsigned int mask = 1 << bitP;

	D[a / 32u] |= mask;
}

int find(unsigned int *D, unsigned int a) {
	unsigned int bitP = a % 32u;
	unsigned int mask = 1 << bitP;

	return (int)((D[a / 32u] & mask) >> bitP);

}

unsigned int conv(char s[]) {
	int i = 0;
	unsigned int a = 0u;
	while (s[i] != '\0') {
		a <<= 2u;
		if (s[i] == 'A') {
			a &= 0xFFFFFFFC;
		}
		else if (s[i] == 'C') {
			a |= 0x00000001;
			a &= 0xFFFFFFFD;
		}
		else if (s[i] == 'G') {
			a &= 0xFFFFFFFE;
			a |= 0x00000002;
		}
		else {
			a |= 0x00000003;
		}
		++i;
	}
	return a;
}

int main() {
	unsigned int *D = (unsigned int *)malloc(sizeof(unsigned int) * MaxSize);
	int i;
	for (i = 0; i < MaxSize; ++i) {
		D[i] = 0u;
	}

	char com[7];
	char s[13];
	int n;
	scanf("%d", &n);
	for (i = 0; i < n; ++i) {
		scanf("%s%s", com, s);
		if (com[0] == 'i') {
			insert(D, conv(s));
		}
		else {
			if (find(D, conv(s))) {
				printf("yes\n");
			}
			else {
				printf("no\n");
			}
		}
	}


	free(D);

	return 0;
}