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

void insert(char *in_str);
bool find(char *target_str);

int num_inserted = 0;
long *dict;

int main(void)
{
    int num_op;
    scanf("%d", &num_op);

    dict = malloc(sizeof(long) * num_op);
    if (dict == NULL) {
        printf("ERROR! Cannot allocate memory.\n");
        return 1;
    }

    char op[6];
    char word_str[13];

    while (num_op--) {
        scanf("%s %s", op, word_str);
        if (strcmp(op, "insert") == 0) {
            insert(word_str);
        } else if (strcmp(op, "find") == 0) {
            if (find(word_str)) {
                printf("yes\n");
            } else {
                printf("no\n");
            }
        } else {
            printf("ERROR! Wrong operation.\n");
        }
    }

    return 0;
}

int char2int(char in);
long str2long(char *in_str);

void insert(char *in_str)
{
    if (find(in_str) == false) {
        dict[num_inserted++] = str2long(in_str);
    }
}

int char2int(char in)
{
    if (in == 'A') {
        return 1;
    } else if (in == 'C') {
        return 2;
    } else if (in == 'G') {
        return 3;
    } else if (in == 'T') {
        return 4;
    } else {
        printf("ERROR! Wrong character.\n");
        return -1;
    }
}

long str2long(char *in_str)
{
    int i;

    int p = 1;
    int in_long = 0;
    for (i = 0; i < (int)(strlen(in_str)); i++) {
        in_long += p * char2int(in_str[i]);
        p *= 5;
    }

    return in_long;
}

bool find(char *target_str)
{
    int i;

    long target_long = str2long(target_str);
    for (i = 0; i < num_inserted; i++) {
        if (dict[i] == target_long) {
            return true;
        }
    }
    return false;
}