#include<string>
#include<iostream>
#include<algorithm>
#include<set>
using namespace std;
int main(){
  set<string> s;
  int n;
  cin >> n;
  while(n--){
    string a,b;
    cin >> a >> b;
    if(a=="insert") s.insert(b);
    else cout << (s.find(b)!=s.end()?"yes":"no") << endl;
  }
}

