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

#define MAX_NUM 1234
#define MAX_STR_LEN (12 + 1)

struct Item {
    struct Item* next;
    char str[MAX_STR_LEN];
};

static struct Item* CreateItem(const char* str) {
    struct Item* p_item = malloc(sizeof(struct Item));

    p_item->next = NULL;
    strncpy(p_item->str, str, MAX_STR_LEN);
    p_item->str[MAX_STR_LEN - 1] = '0';

    return p_item;
}

static void DeleteItem(struct Item* p_item) {
    free(p_item);

    return;
}

static void InitializeDic(struct Item* p_dic[]) {
    int i;

    for ( i = 0; i < MAX_NUM; i++ ) {
        p_dic[i] = NULL;
    }

    return;
}

static void FinalizeDic(struct Item* p_dic[]) {
    int i;
    struct Item* p_item;

    for ( i = 0; i < MAX_NUM; i++ ) {
        if ( p_dic[i] ) {
            for ( p_item = p_dic[i]; p_item != NULL; ) {
                struct Item* p_next = p_item->next;

                DeleteItem(p_item);

                p_item = p_next;
            }
        }
    }

    return;
}

static inline int CtoV(int c) {
    switch (c) {
    case 'A':
        return 1;
    case 'C':
        return 2;
    case 'G':
        return 3;
    case 'T':
        return 5;
    }

    assert( 0 );
    
    return -1;
}


static int hash(const char* str) {
    int i;
    unsigned int v = 0;

    for ( i = 0; str[i] != '\0'; i++ ) {
        v = v * 7 + CtoV(str[i]);
    }

    return v % MAX_NUM;
}

static int find(struct Item* p_dic[], const char* str) {
    int h = hash(str);
    struct Item* p_item;

    for ( p_item = p_dic[h]; p_item != NULL; p_item = p_item->next ) {
        if ( strcmp(p_item->str, str) == 0 ) {
            return 1;
        }
    }

    return 0;
}

static void insert(struct Item* p_dic[], const char* str) {
    int h = hash(str);
    struct Item* p_item;

    if ( p_dic[h] == NULL ) {
        p_dic[h] = CreateItem(str);
    } else {
        if ( find(p_dic, str) == 0 ) {
/*            printf("X [%s] -> %d\n", str, h);*/
            p_item = CreateItem(str);
            p_item->next = p_dic[h];
            p_dic[h] = p_item;
        }
    }

    return;
}

int main(int argc, char* argv[]) {
    int n;
    struct Item* dic[MAX_NUM];
    char order[10];
    char str[MAX_STR_LEN];
    const char* result[] = { "no", "yes" };

    InitializeDic(dic);
    
    fscanf(stdin, "%d\n", &n);
    for ( int i = 0; i < n; i++ ) {
        fscanf(stdin, "%s %s\n", order, str);
        if ( strcmp(order, "insert") == 0 ) {
            insert(dic, str);
        } else if ( strcmp(order, "find") == 0 ) {
            int r = find(dic, str);
            printf("%s\n", result[r]);
        } else {
            assert( 0 );
        }
    }

    FinalizeDic(dic);

    return 0;
}

