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

long id(char *);
void insert(char *);
void find(char *);

int num=0;
long dic[1000000];

int main(void)
{
	int i, n;
	char op[7], str[13];
	
	scanf("%d",&n);
	for (i=0; i<n; i++) {
		scanf("%s %s",op,str);
		if( strcmp(op, "insert") == 0 ) {
			insert(str);
		} else if( strcmp(op, "find") == 0 ) {
			find(str);
		}
	}
	
	return 0;
}

long id(char *str)
{
	int i;
	long id=0;
	
	i = 0;
	while (1) {
		if(str[i] == '\0') break;
		switch (str[i]) {
		case 'A':
			id += (long)pow(5,i) * 1;
			break;
		case 'C':
			id += (long)pow(5,i) * 2;
			break;
		case 'G':
			id += (long)pow(5,i) * 3;
			break;
		case 'T':
			id += (long)pow(5,i) * 4;
			break;
		}
	i++;
	}
	return id;
}

void insert(char *str)
{
	dic[num] = id(str);
	num++;
}

void find(char *str)
{
	int i=0;
	long key;
	key = id(str);
	dic[num] = key;
	while ( dic[i] != key ) {
		i++;
	}
	if( i == num ) {
		printf("no\n");
	} else {
		printf("yes\n");
	}
}