#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
using namespace std;
vector <string> hash[300010];
int n;
int hashval(string s){
int x = 0;
for(int i = 0; i < (int)s.size(); ++i)
x = (x * 120 + s[i]) % 300007;
return x;
}
string getst(){
string x = "";
char ch = getchar();
while(ch != '\n'){
x = x + ch;
ch = getchar();
}
return x;
}
int main(void)
{
cin >> n;
for(int i=1; i<=n; ++i){
string s;
string book;
cin >> s;
book = getst();
if(s == "add")
hash[hashval(book)].push_back(book);
else{
int t = hashval(book), flag = 0;
for(int i=0; i<(int)hash[t].size(); ++i)
if(book == hash[t][i])
flag = 1;
if(flag) cout << "yes" << endl;
else cout << "no" << endl;
}
}
}