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

int hash_search(int len,char *ch)
{
    int nk,kn=0;
    for(int i=0;i<len;i++)
    {
        switch(ch[i])
        {
            case 'A':
            nk=0;
            break;
            case 'C':
            nk=1;
            break;
            case 'G':
            nk=2;
            break;
            case 'T':
            nk=3;
            break;
        }
        kn = kn *4 + nk;
    }
    return kn;
}

void insert(char **word,char *ch,int len)
{
    int nk,kn=hash_search(len,ch);
    //printf("insert ch chk = %s\n",ch);
    //printf("insert kn chk = %d\n",kn);
    word[len-1][kn] = 1;
}

void find(char **word,char *ch,int len)
{
    int nk,kn=hash_search(len,ch);
    //printf("find ch chk = %s\n",ch);
    //printf("find kn chk = %d\n",kn);
    if(word[len-1][kn]==1) printf("yes\n");
    else printf("no\n");
}

int main()
{
    int n,p=1;
    scanf("%d",&n);
    char *word[12],CH[13],order[7];
    for(int i=0;i<12;i++)
    {
        p*=4;
        word[i]=malloc(sizeof(char)*p);
    }
    for(int i = 0;i<n;i++)
    {
        scanf("%s %s",order,CH);
        if(strcmp(order,"insert")==0)
        {
            insert(word,CH,strlen(CH));
        }
        else
        {
            find(word,CH,strlen(CH));
        }
    }
}
