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

int main()
{
	typedef set<string> set_t;
	set_t A;
	string S,T;
	int n;
	cin >> n;

	for (int i = 0; i < n; ++i)
	{
		cin >> S >> T;
		if (S == "insert")
		{
			A.insert(T);
		}
		else
		{
			if (A.count(T))
			{
				cout << "yes" << endl;
			}
			else
			{
				cout << "no" << endl;
			}
		}
	}
	return 0;
}
