#define _CRT_SECURE_NO_WARNINGS
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define int ll
//#define endl "\n"
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
template<class T> ostream & operator<<(ostream & os, vector<T> const &);
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":" ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream & os, tuple<T...> const & t){ _ot<0>(os, t); return os; }
template<class T, class U> ostream & operator<<(ostream & os, pair<T,U> const & p){ return os << "(" << p.first << ", " << p.second << ") "; }
template<class T> ostream & operator<<(ostream & os, vector<T> const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; }
template<class T> inline bool chmax(T & x, T const & y){ return x<y ? x=y,true : false; }
template<class T> inline bool chmin(T & x, T const & y){ return x>y ? x=y,true : false; }
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<mt(__VA_ARGS__)<<" ["<<__LINE__<<"]"<<endl)
#else
#define dump(...)
#endif
// ll const mod = 1000000007;
// ll const inf = 1LL<<60;

/*
  ch は小さいほうが良い
 */

struct Trie {
    struct Node {
        int val;
        Node * ch[26];
        Node() : val(0) {
            fill(ch, ch+26, nullptr);
        }
        ~Node(){
            for(auto & p : ch) if(p != nullptr) delete p;
        }
    };
    Node *r;

    void insert(string const &s){
        auto p = s.begin();
        Node * cur = r;
        while(1){
            if(p == s.end()){
                cur->val++;
                break;
            } else {
                Node * &nxt = cur->ch[*p-'A'];
                if(nxt == nullptr) nxt = new Node();
                cur = nxt;
                ++p;
            }
        }
    }
    bool erase(string const &s){
        auto p = s.begin();
        Node * cur = r;
        while(1){
            if(p == s.end()){
                if(cur->val > 0){
                    cur->val--;
                    return true;
                } else {
                    return false;
                }
            } else {
                Node * &nxt = cur->ch[*p-'A'];
                if(nxt == nullptr) return false;
                cur = nxt;
                ++p;
            }
        }
    }
    bool find(string const& s){
        auto p = s.begin();
        Node * cur = r;
        while(1){
            if(p == s.end()){
                return cur->val > 0;
            } else {
                Node * &nxt = cur->ch[*p-'A'];
                if(nxt == nullptr) return false;
                cur = nxt;
                ++p;
            }
        }
    }
    Trie() : r(new Node()) {}
    ~Trie() { delete r; }
};

int main(){
    int n;
    cin >> n;
    Trie t;
    rep(i,n){
        char com[15], str[15];
        cin >> com >> str;
        if(com[0] == 'i'){
            t.insert(str);
        } else {
            puts(t.find(str) ? "yes" : "no");
        }
    }
}

Measured memory_bytes: 77264