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

#define M 1046527
#define NIL (-1)
#define L 14

static char H[M][L];

static int getChar(char ch)
{
    if (ch == 'A') {
        return 1;
    } else if (ch == 'C') {
        return 2;
    } else if (ch == 'G') {
        return 3;
    } else if (ch == 'T') {
        return 4;
    } else {
        return 0;
    }
}

static int getKey(char* s)
{
    int key = 0;
    int p = 1;

    for (int i = 0; i < strlen(s); i++) {
        key += p * getChar(s[i]);
        p *= 5;
    }

    return key;
}

static int h1(int key)
{
    return key % M;
}

static int h2(int key)
{
    return 1 + (key % (M - 1));
}

static int hash(int key, int i)
{
    return (h1(key) + i * h2(key)) % M;
}

static bool find(char* s)
{
    int key = getKey(s);

    for (int i = 0;; i++) {
        int h = hash(key, i);
        if (strcmp(H[h], s) == 0) {
            return true;
        } else if (H[h][0] == '\0') {
            return false;
        }
    }

    return false;
}

static bool insert(char* s)
{
    int key = getKey(s);

    for (int i = 0;; i++) {
        int h = hash(key, i);
        if (strcmp(H[h], s) == 0) {
            return true;
        } else if (H[h][0] == '\0') {
            strcpy(H[h], s);
            return false;
        }
    }

    return false;
}

int main()
{
    int n;
    char command[7];
    char s[L];

    scanf("%d", &n);

    for (int i = 0; i < M; i++) {
        H[i][0] = '\0';
    }

    for (int i = 0; i < n; i++) {
        scanf("%s %s", command, s);

        if (command[0] == 'i') {
            insert(s);
        } else {
            if (find(s)) {
                printf("yes\n");
            } else {
                printf("no\n");
            }
        }
    }

    return 0;
}
