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

#define HASH_TBL_SIZE 1000001
int T[HASH_TBL_SIZE] = {0};

int h1(int k) {
    return k % HASH_TBL_SIZE;
}

int h2(int k) {
    // return h1(k);
    return 1 + k % (HASH_TBL_SIZE - 1);
}

int h(int k, int i) {
    return (h1(k) + i * h2(k)) % HASH_TBL_SIZE;
}

int strhash(char *str) {
    int i, val = 0;
    for (i=0;i<strlen(str);i++) {
        val *= 4;
        if (str[i] == 'A') {
            val += 1;
        } else if (str[i] == 'C') {
            val += 2;
        } else if (str[i] == 'G') {
            val += 3;
        } else if (str[i] == 'T') {
            val += 4;
        }
    }
    return val;
}

unsigned int BKDRHash(char *str) {
    unsigned int seed = 31; // 31 131 1313 13131 131313 etc..
    unsigned int hash = 0;

    while (*str) {
        hash = hash * seed + (*str++);
    }

    return (hash & 0x7FFFFFFF);
}

// return -1 when full
int insert(int T[], int k) {
    int i = 0, index = 0;
    for (i = 0; i < HASH_TBL_SIZE; i++) {
        index = h(k, i);
        if (T[index] == 0) {
            T[index] = k;
            return index;
        }
    }
    return -1;
}

int search(int T[], int k) {
    int i = 0, index = 0;
    for (i = 0; i < HASH_TBL_SIZE; i++) {
        index = h(k, i);
        if (T[index] == k) {
            return index;
        }
        if (T[index] == 0) {
            break;
        }
    }
    return -1;
}

int main() {
    int n, i, k;
    char cmd[100], str[100];
    for (i = 0; i < HASH_TBL_SIZE; i++) {
        T[i] = 0;
    }
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%s %s", cmd, str);
        k = strhash(str);
        if (cmd[0] == 'i') {
            insert(T, k);
        } else {
            if (search(T, k) == -1) {
                printf("no\n");
            } else {
                printf("yes\n");
            }
        }
    }
    return 0;
}
