#include<cstdio>
#include<string>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<iostream>
#include<set>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
int n;
string str;
string mess;
set<string> ma;
int main(){
	scanf("%d\n",&n);
	rep(i,n){
		cin>>str>>mess;
		if(str[0]=='i'){
			ma.insert(mess);
		}else{
			if(ma.find(mess)!=ma.end()){
				cout <<"yes"<<endl;
			}else{
				cout <<"no"<<endl;
			}
		}
	}
	return 0;
}