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

#define MAX 1046527
#define NIL (-1)
#define L 14

char H[MAX][L];

int getCharVal(char c) {
    int v = 0;
    switch (c) {
        case 'A': v = 1; break;
        case 'C': v = 2; break;
        case 'G': v = 4; break;
        case 'T': v = 8; break;
        default: break;
    }
    return v;
}

int getStringVal(char s[]) {
    int v = 0;
    int p = 1;
    for (int i = 0; i < strlen(s); i++) {
        v += p*getCharVal(s[i]);
        p *= 3;
    }
    return v;
}

int h1(int key) {
    return key % MAX;
}

int h2(int key) {
    return 1 + (key % (MAX - 1));
}


int insert(char H[][L], char s[]) {
    int key, h, i;
    h = 0;

    key = getStringVal(s);
    for (i = 0; ; i++) {
        h = (h1(key) + i * h2(key)) % MAX;
        if (strcmp(H[h], s) == 0) return 1;
        if (strlen(H[h]) == 0) {
            strcpy(H[h], s);
            return 0;
        }
    }
    return 0;
}

int find(char H[][L], char s[]) {
    int key, h, i;
    h = 0;
    key = getStringVal(s);
    for (i = 0; ;i++) {
        h = (h1(key) + i * h2(key)) % MAX;
        if (strcmp(H[h], s) == 0) return 1;
        if (strlen(H[h]) == 0) return 0;
    }
    return 0;
}



int main() {

    int n, i;
    char com[L], s[L];
    // char H[MAX][L];
    scanf("%d", &n);
    for (i = 0; i < MAX; i++) H[i][0] = '\0';
    for (i = 0; i < n; i++) {
        scanf("%s%s", com, s);
        if (com[0] == 'i') insert(H, s);
        else if (com[0] == 'f') {
            printf(find(H, s) ? "yes\n" : "no\n");
        }
    }
    return 0;
}
