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

#define A_CH 0
#define C_CH 1
#define G_CH 2
#define T_CH 3

void sortTailNum(char **strs, int tail) 
{
    int i;
    char *tail_str;

    tail_str = strs[tail];
    if(tail == 0)
        return;
    for(i = tail - 1; i >= 0; i--) {
        strs[i + 1] = strs[i];
        if(strcmp(tail_str, strs[i]) >= 0)
            break;
    }
    strs[i + 1] = tail_str;
}

void binarySearch(char *str, char **strs, int left, int right)
{
    int mid = (left + right) / 2; 
    int isEqual;

    if(left > right) {
        printf("no\n");
        return;
    }
    //if(!strcmp(strs[left], str) || !strcmp(strs[right], str)) {
    //    printf("yes\n");
    //    return;
    //}
    isEqual = strcmp(strs[mid], str);
    if(isEqual == 0) {
        printf("yes\n");
        return;
    } else if(isEqual > 0) {
        binarySearch(str, strs, left, mid - 1);
    } else if(isEqual < 0) {
        binarySearch(str, strs, mid + 1, right);
    }
}

int getChNum(char ch)
{
    switch(ch) {
        case 'A':
            return A_CH;
            break;

        case 'C':
            return C_CH;
            break;

        case 'G':
            return G_CH;
            break;

        case 'T':
            return T_CH;
            break;

        default:
            break;
    }

}

int main(void) 
{
    int i, n, whichCh;
    int tails[4] = {-1, -1, -1, -1};
    char str[12], ***strs;

    scanf("%d", &n);
    strs = malloc(sizeof(char**) * 4);
    for(i = 0; i < 4; i++)
        strs[i] = malloc(sizeof(char*) * n);

    for(i = 0; i < n; i++) {
        scanf("%s", str);
        if(strcmp(str, "insert") == 0) {
            scanf("%s", str);
            whichCh = getChNum(str[0]);
            strs[whichCh][++tails[whichCh]] = malloc(sizeof(char) * 12);
            strcpy(strs[whichCh][tails[whichCh]], str);
            sortTailNum(strs[whichCh], tails[whichCh]);
        } else if(strcmp(str, "find") == 0) {
            scanf("%s", str);
            whichCh = getChNum(str[0]);
            binarySearch(str, strs[whichCh], 0, tails[whichCh]);
        }
    }

    return 0;
}