#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define N 100000000
#define pi M_PI
char H[N];

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( 1 == H[ getKey( str ) ] ) {
        return 1;
    } else {
        return 0;
    }
}
 
void insert( char str[] )
{
    H[ getKey( str ) ] = 1;
    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;
}
