#include <stdio.h>

#define gc() getchar()

int bits['T' + 1];
char dic[33554432];

int main(void){
    int t, n, c;
    bits['A'] = 0; bits['C'] = 1; bits['G'] = 2; bits['T'] = 3;
    scanf("%d", &n);
    c = gc(); // 改行読み捨て
    while (n--) {
        c = gc();
        if (c == 'i') {
            t = 7;
            while (--t) gc();
            t = 1;
            while ((c = gc()) >= ' ') {
                t <<= 2;
                t |= bits[c];
            }
            dic[t] = 1;
        } else {
            t = 5;
            while (--t) gc();
            t = 1;
            while ((c = gc()) >= ' ') {
                t <<= 2;
                t |= bits[c];
            }
            if (dic[t]) printf("yes\n");
            else printf("no\n");
        }
    }
}

