#define _CRT_SECURE_NO_WARNINGS
#include <memory>
#include <type_traits>
#include <utility>
using namespace std;
template <class Key, class T> class splay_tst_associative_array {
public:
	using key_type = Key;
	using value_type = T;
	using reference = value_type & ;

	static_assert(is_default_constructible<value_type>::value,
		"T must be default constructible");

private:
	using key_value = typename key_type::value_type;
	class node_type;
	class next_ptr {
	public:
		unique_ptr<node_type> ptr;
		typename splay_tst_associative_array::value_type value;
		next_ptr() : ptr(), value() {}
	};

	class node_type 
	{
		using key_value = typename splay_tst_associative_array::key_value;

	public:
		key_value key;
		unique_ptr<node_type> left, right;
		next_ptr middle;
		node_type(const key_value &key_) : key(key_), left(), right(), middle() {}
	};
	
	using pointer = unique_ptr<node_type>;
	using p_ptr = pointer * ;
	next_ptr root;

public:
	splay_tst_associative_array() : root() {}
	template <class InputIterator>
	splay_tst_associative_array(InputIterator first, InputIterator last)
		: root() {
		for (; first != last; ++first)
			operator[](first->first) = first->second;
	}

	bool empty() const { return !root.ptr; }

	reference operator[](const key_type &key) {
		next_ptr *prev = &root;
		for (const auto &elm : key) {
			pointer ptr = move(prev->ptr);
			pointer sub_l, sub_r; // con trai va con phai
			p_ptr left = &sub_l, right = &sub_r;
			while (1)
			{
				if (!ptr)
					ptr = make_unique<node_type>(elm);
				if (!(ptr->key <= elm)) 
				{
					if (!ptr->left)
						ptr->left = make_unique<node_type>(elm);
					if (!(ptr->left->key <= elm)) 
					{
						*right = move(ptr->left);
						ptr->left = move((*right)->right);
						(*right)->right = move(ptr);
						right = &(*right)->left;
						ptr = move(*right);
					}
					else if (!(elm <= ptr->left->key)) 
					{
						*right = move(ptr);
						right = &(*right)->left;
						*left = move(*right);
						left = &(*left)->right;
						ptr =move(*left);
					}
					else {
						*right = move(ptr);
						right = &(*right)->left;
						ptr = move(*right);
					}
				}
				else if (!(elm <= ptr->key))
				{
					if (!ptr->right)
						ptr->right = make_unique<node_type>(elm);
					if (!(ptr->right->key <= elm)) {
						*left =move(ptr);
						left = &(*left)->right;
						*right = move(*left);
						right = &(*right)->left;
						ptr = move(*right);
					}
					else if (!(elm <= ptr->right->key)) 
					{
						*left = move(ptr->right);
						ptr->right = move((*left)->left);
						(*left)->left = move(ptr);
						left = &(*left)->right;
						ptr = move(*left);
					}
					else {
						*left = move(ptr);
						left = &(*left)->right;
						ptr = move(*left);
					}
				}
				else {
					*left = move(ptr->left);
					ptr->left = move(sub_l);
					*right = move(ptr->right);
					ptr->right = move(sub_r);
					break;
				}
			}
			prev->ptr = move(ptr);
			prev = &prev->ptr->middle;
		}
		return prev->value;
	}
};

#include <iostream>
#include <string>

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

	splay_tst_associative_array<string, bool> sta;

	while (n--) 
	{
		string t, s;
		cin >> t >> s;

		if (t == "insert") 
		{
			sta[s] = 1;
		}
		else 
		{
			cout << (sta[s] ? "yes" : "no") << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 25224