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

struct dict {
    char str[15];
    struct dict *next;
};
typedef struct dict t_dict;

t_dict *root;

int find(char *str)
{
    t_dict *p = root;
    while (p != NULL) {
        //printf("%s\n", p->str);
        if (strcmp(str, p->str)==0) {
            return 1;
        }
        p = p->next;
    }
    return 0;
}

void insert(char *str)
{
    t_dict *d = (t_dict*)malloc(sizeof(t_dict));
    strcpy(d->str, str);
    
    if (root->str == NULL) {
        strcpy(d->str, str);
        d->next = NULL;
        root = d;
    }
    else {
        d->next = root->next;
        root->next = d;
    }
}


int main()
{
    root = (t_dict*)malloc(sizeof(t_dict));
    //root->str = NULL;
    root->next = NULL;
    
    int i;
    char cmd[10], str[15];
    int N;
    scanf("%d", &N);
    for (i = 0; i < N; i++) {
        scanf("%s %s", cmd, str);
        if (strcmp(cmd, "insert")==0) {
            insert(str);
        }
        else {
            if (find(str)) {
                puts("yes");
            }
            else {
                puts("no");
            }
        }
    }
    
    return 0;
}