#include<stdio.h>
#include<string.h>
#define M 50000000
#define found 1
char H[M];

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

int getKey(char str[] ){
	int i;
	int key = 0, base = 1;
	for ( i=0; '\0'!=str[i]; i++ ) {
		key += base*( getChar( str[i] ) );
		base *= 5;
	}
	return key;
}

int find( char str[] ){
	if( found == H[ getKey( str ) ] ) 
		return found;
	else 
		return 0;
	
}

void insert(char str[] ){
	H[ getKey(str) ] = found;
	return;
}

int main() {

	int i, a;
	char str[14], com[9];
	
	scanf("%d", &a);
	for ( i = 0; i < a; 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;
}

