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

struct Ch{
	struct Ch *a;
	struct Ch *c;
	struct Ch *g;
	struct Ch *t;
	int end;
};

struct Ch *ghead;

int glen;

void init( )
{
	ghead = malloc( sizeof( struct Ch ) );
	ghead->a = ghead;
	ghead->c = ghead;
	ghead->g = ghead;
	ghead->t = ghead;
	ghead->end = 0;
}

int  searchStr( char *str )
{
	struct Ch *cur,*pre;
	int i;

	cur=ghead;
	i=0;
	while( i<glen ) {
		pre=cur;
		if( 'A' == str[i] ) {
			cur=cur->a;
		} else if( 'C' == str[i] ) {
			cur=cur->c;
		} else if( 'G' == str[i] ) {
			cur=cur->g;
		} else if( 'T' == str[i] ) {
			cur=cur->t;
		}
		if( ghead == cur ) { break; }
		i++;
	}
	return cur->end;
 }
 
void insertStr( char *str )
{
	struct Ch *x;
	struct Ch *cur,*pre;
	int i;

	cur=ghead;
	i=0;
	while( i<glen ) {
		pre=cur;
		if( 'A' == str[i] ) {
			cur=cur->a;
		} else if( 'C' == str[i] ) {
			cur=cur->c;
		} else if( 'G' == str[i] ) {
			cur=cur->g;
		} else if( 'T' == str[i] ) {
			cur=cur->t;
		}
		if( ghead == cur ) { break; }
		i++;
	}

	if( ghead == cur ) {
		while( i<glen ) {
			x = malloc( sizeof( struct Ch ) );
			x->a=ghead;
			x->c=ghead;
			x->g=ghead;
			x->t=ghead;
			if( 'A' == str[i] ) {
				pre->a=x;
			} else if( 'C' == str[i] ) {
				pre->c=x;
			} else if( 'G' == str[i] ) {
				pre->g=x;
			} else if( 'T' == str[i] ) {
				pre->t=x;
			}
			x->end=0;
			pre=x;
			i++;
		}
		x->end=1;
	}
}

 
int main( void ) 
{
    int n;
 	char str[14];  
 	char com[8]; 
    int i;
   
	init( );
    scanf( "%d", &n );
    for( i=0; i<n; i++ ) {
        scanf( "%s%s", com, str );
    	glen = strlen( str ); 
        if( 'i' == com[0] ) {
        	insertStr( str );
        } else {
	        if( searchStr( str ) ) {
		        printf( "yes\n" );
		    } else {
		        printf( "no\n" );
		    }		    
	    }
    }
    return 0;
}	