#include <iostream>
#include <unordered_set>
#include <string>

int main(){
    std::unordered_set<std::string> s;
    int n;
    std::cin >> n;
    std::string command, str;
    for(int i=0; i<n; ++i){
        std::cin >> command >> str;
        if(command == "insert"){
            s.insert(str);
        }else{
            std::cout << ((s.count(str) == 1) ? "yes" : "no") << std::endl;
        }
    }
}
