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

#define M (244140624 / 13)
#define L 13

bool isExist[M][L] = {{false}};

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

int num_inserted = 0;

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

    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);

long hashFunc1(long in);
int hashFunc2(long in);

void insert(char *in_str)
{
    if (find(in_str) == false) {
        long in_long = str2long(in_str);
        long hash1 = hashFunc1(in_long);
        int hash2 = hashFunc2(in_long);
        isExist[hash1][hash2] = true;
    }
}

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;
}

long hashFunc1(long in)
{
    return (in % M);
}

int hashFunc2(long in)
{
    return (in % L);
}

bool find(char *target_str)
{
    long target_long = str2long(target_str);
    long hash1 = hashFunc1(target_long);
    int hash2 = hashFunc2(target_long);
    return isExist[hash1][hash2];
}