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

typedef unsigned int U;
#define L 1<<21
bool HA[L];
char T[256];

int main() {
    U n, s, t;
    char c;
    T['A'] = 1, T['C'] = 2, T['G'] = 3, T['T'] = 4;
    scanf("%d", &n);
    getchar();
    while (n--) {
        s = 0;
        t = 1;
        bool flag = ( c = getchar() ) == 'i';
        while ( ( c = getchar() ) != ' ' );
        while ( ( c = T[getchar()] ) != 0 ) {
            s += c * t;
            t *= 4;
        }
        if ( flag ) {
            HA[s] = true;
        } else {
            puts( HA[s] ? "yes" : "no" );
        }
    }
    return 0;
}