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

#define M 48828125
#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, n;
	char str[14], com[9];
	
	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;
}