#include <stdio.h>
#include <stdlib.h>
 
#define newTree() ((PTREE)calloc(1, sizeof(TREE)))
 
int code[128] = { 0 };
 
typedef struct _tree {
    int flag;
    struct _tree *list[4];
} TREE, *PTREE;

void insert(PTREE root, char *str) {
    int i;
    if (*str == '\0') {
        root->flag = 1;
        return;
    }
    i = code[(int)*str];
    if (root->list[i] == NULL) {
        root->list[i] = newTree();
    }
    insert(root->list[i], str + 1);
}
 
int find(PTREE root, char *str) {
    int i;
    if (*str == '\0') {
        return root->flag;
    }
    i = code[(int)*str];
    if (root->list[i] == NULL) {
        return 0;
    }
    return find(root->list[i], str + 1);
}
 
int main(void) {
    int i, n;
    char cmd[20], str[20];
    PTREE root = newTree();
    code['A'] = 0;
    code['C'] = 1;
    code['G'] = 2;
    code['T'] = 3;
     
    scanf("%d", &n);
     
    for (i = 0; i < n; ++i) {
        scanf("%s %s", cmd, str);
        if (cmd[0] == 'i') {
            insert(root, str);
        } else if (find(root, str)) {
            printf("yes\n");
        } else {
            printf("no\n");
        }
    }
     
    return 0;
}