#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
using namespace std;
 
const long M = 1046527;
string H[M];
 
long getKey(string str){
    long sum = 0, p = 1, digit = 0;
    for (long i = 0; i < str.size(); i++){
        if (str[i] == 'A') digit = 1;
        else if (str[i] == 'C') digit = 2;
        else if (str[i] == 'G') digit = 3;
        else if (str[i] == 'T') digit = 4;
        else digit = 0;
        sum += p * digit;
        p *= 5;
    }
    return sum;
}
 
long h1(long key){return key % M;}
long h2(long key){return 1 + (key % (M - 1));}
 
long find(string str){
    long key = getKey(str);
    for (long i = 0; ; i++){
        long h = (h1(key) + i * h2(key)) % M;
        if (H[h] == str) return 1;
        else if (H[h].size() == 0) return 0;
    }
    return 0;
}
 
long insert(string str){
    long key = getKey(str);
    for (long i = 0; ; i++){
        long h = (h1(key) + i * h2(key)) % M;
        if (H[h] == str) return 1;
        else if (H[h].size() == 0){
            H[h] = str;
            return 0;
        }
    }
}
 
int main(){
    long n;
    string str, com;
    cin >> n;
    for (long i = 0; i < n; i++){
        cin >> com >> str;
        if (com[0] == 'i') insert(str);
        else {
            if (find(str)) cout << "yes" << endl;
            else cout << "no" << endl;
        }
    }
    return 0;
}