#include <iostream>
#include <cstring>
using namespace std;

#define M 1046527
string Hash[M];
long long key, hash_Num;

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

int get_Char(char ch){
    if(ch == 'A') return 1;
    else if(ch == 'B') return 2;
    else if(ch == 'C') return 3;
    else if(ch == 'D') return 4;
    else return 0;
}


long long get_Key(string str){
    long long sum = 0, p = 1;
    for(int i = 0; i < str.size(); i++){
        sum += p * (get_Char(str[i]));
        p *= 5;
    }
    return sum;
}


void str_Insert(string str){
    key = get_Key(str);
    for(int i = 0; ; i++){
        hash_Num = ( h1(key) + i * h2(key) ) % M;
        if(Hash[hash_Num] == str) return;
        else if( Hash[hash_Num].size() == 0){
            Hash[hash_Num] = str;
            return;
        }
    }
    return;
}


int str_Find(string str){
    key = get_Key(str);
    for(int i = 0; ; i++){
        hash_Num = ( h1(key) + i * h2(key) ) % M;
        if(Hash[hash_Num] == str) return 1;
        else if( Hash[hash_Num].size() == 0) return 0;
    }
    return 0;
}


int main(void){
    
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        string str, job;
        cin >> job >> str;
        
        if(job[0] == 'i'){ str_Insert(str); }
        
        else{
            if(str_Find(str)){ cout << "yes" << endl; }
            else{ cout << "no" << endl; }
        }
    }
    
    
}




/***********************************************************************

#include <iostream>
using namespace std;

#define M 1046527

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

long long getKey(string target) {
    long long sum = 0;
    long long p = 1;
    for (int i = 0; i < target.length(); i++) {
        sum += p * charToValue(target[i]);
        p *= 4;
    }

    return sum;
}

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

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

int main() {
    int n;
    cin >> n;

    string dict[M];
    for (int i = 0; i < M; i++) {
        dict[i] = "";
    }

    string command;
    string target;
    long long keySeed;
    int key;
    for (int i = 0; i < n; i++) {
        cin >> command;
        cin >> target;

        keySeed = getKey(target);
        key = h1(keySeed);
        if (command == "insert") {
            int j = 1;
            while (dict[key] != "") {
                key = (h1(keySeed) + (j * h2(keySeed))) % M;
                j++;
            }
            dict[key] = target;
        } else {
            int j = 1;
            bool find = false;
            while (dict[key] != "") {
                if (dict[key] == target) {
                    find = true;
                    break;
                }
                key = (h1(keySeed) + (j * h2(keySeed))) % M;
                j++;
            }

            if(find) {
                cout << "yes" << endl;
            } else {
                cout << "no" << endl;
            }
        }
    }

    return 0;
}

***************************************************************************/



Measured memory_bytes: 27388