#include <stdio.h>
#include <string.h>
#define CMAX 14
#define MAX 1000000

int insert(char[]);
int find(char[]);
int getChar(char);
long long getKey(char[]);

int h1(int);
int h2(int);

char dictionary[MAX][CMAX];
int n;

int main(){
    char command[9],str[CMAX];

    for(int i = 0;i < MAX;i++)dictionary[i][0] = '\0';

    scanf("%d",&n);

    for(int i = 0;i < n;i++){
        scanf("%s %s",command,str);
        if(strcmp("insert",command) == 0)insert(str);
        else if(strcmp("find",command) == 0){
            if(find(str))printf("yes\n");
            else printf("no\n");
        }
    }

    return 0;
}

int h1(int key){return key % n;}

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

int insert(char str[CMAX]){
    int i = 0,j;
    while(1){
        j = h1(getKey(str)) + i * h2(getKey(str));
        if(dictionary[j][0] == '\0'){
            strcpy(dictionary[j],str);
            return j;
        }
        else i = i + 1;
    }
}

int find(char str[]){
    for(int i = 0;i < MAX;i++){if(strcmp(dictionary[i],str) == 0)return 1;}
    return 0;
}

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;
    return 0;
}

long long getKey(char str[]){
    long long sum = 0, p = 1, i;
    for ( i = 0; i < strlen(str); i++ ){
        sum += p*(getChar(str[i]));
        p *= 5;
    }
    return sum;
}


