#include <iostream>
#include <string>
#include <set>
using namespace std;

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

  set<string> dict;
  for(int i=0;i<n;i++){
    string command, word;
    cin >> command;
    if(command=="insert"){
      cin >> word;
      dict.insert(word);
    }else{
      cin >> word;
      if(dict.count(word)>0) cout << "yes" << endl;
      else cout << "no" << endl;
    }
  }

  return 0;
}