#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
using ULL = unsigned long long int;
using LD = long double;
#define int LL
// #define double LD
template <typename T> using V = std::vector<T>;
using VI = V<int>;
using VVI = V<V<int>>;
using VVVI = V<V<V<int>>>;
using VD = V<double>;
using VVD = V<V<double>>;
#define PB push_back
#define RSV reserve
#define EB emplace_back
#define ALL(A) (A).begin(), (A).end()
#define SUM(A) std::accumulate(ALL(A), int(0))
#define SUMD(A) std::accumulate(ALL(A), double(0))
#define AVE(A) SUM(A)/(A).size()
#define AVED(A) SUMD(A)/(A).size()
template <typename T1, typename T2> using P = std::pair<T1, T2>;
template <typename T> using PI = P<int, T>;
using PII = PI<int>;
using PIS = PI<std::string>;
#define MP std::make_pair
#define F first
#define S second
#define FOR(I,A,B) for(int I=int(A); I<int(B); ++I)
#define FORR(I,A,B) for(int I=int(A); I>=int(B); --I)
#define REP(I,B) FOR(I,0,B)
constexpr int kMOD = 1e9+7;
const double kPI = std::acos(-1);
struct Read {
	auto operator()(void) {
		int d;
		std::cin >> d;
		return d;
	}
}read;
struct ReadReal {
	auto operator()(void) {
		double d;
		std::cin >> d;
		return d;
	}
}readR;
struct ReadString {
	auto operator()(void) {
		std::string s;
		std::cin >> s;
		return s;
	}
}readS;
struct ReadEof {
	bool operator()(void) {
		return std::cin.eof();
	}
}readEof;
struct Print {
	void operator()(void) {
		std::cout << " ";
	}
	void operator()(double lf) {
		std::cout << std::fixed << std::setprecision(16) << lf;
	}
	template <typename T> void operator()(T t) {
		std::cout << t;
	}
	template <typename T1, typename T2>
	void operator()(const std::pair<T1, T2> &pair, const std::string &sep = ":") {
		std::cout << pair.first << sep << pair.second;
	}
	template <typename T>
	void operator()(T begin, T end, const std::string &sep = " ") {
		if (begin == end) return;
		Print()(*begin);
		for(auto it = ++begin;  it != end; ++it) {
			Print()(sep);
			Print()(*it);
		}
	}
	template <typename T>
	void operator()(const std::vector<T> &v, const std::string &sep = " ") {
		Print()(v.cbegin(), v.cend(), sep);
	}
	template <typename T>
	void operator()(std::initializer_list<T> list, const std::string &sep = " ") {
		Print()(list.begin(), list.end(), sep);
	}
}print;
struct Println {
	void operator()(void) {
		std::cout << std::endl;
	}
	void operator()(double lf) {
		Print()(lf);
		Println()();
	}
	template <typename T> void operator()(T t) {
		Print()(t);
		Println()();
	}
	template <typename T1, typename T2>
	void operator()(const std::pair<T1, T2> &pair, const std::string &sep = ":") {
		Print()(pair, sep);
		Println()();
	}
	template <typename T>
	void operator()(T begin, T end, const std::string &sep = " ") {
		Print()(begin, end, sep);
		Println()();
		return;
	}
	template <typename T>
	void operator()(const std::vector<T> &v, const std::string &sep = " ") {
		Print()(v.cbegin(), v.cend(), sep);
		Println()();
	}
	template <typename T>
	void operator()(std::initializer_list<T> list, const std::string &sep = " ") {
		Print()(list.begin(), list.end(), sep);
		Println()();
	}
}println;

constexpr long long kTableMax = 1'046'527;  // キャロル数
// ダブルハッシュを用いたオープンアドレス法
class HashTable {
public:
	HashTable(void): m_Table(){
	}
	auto CToKey(char c) const {
		switch (c) {
			case 'A': return 1;
			case 'C': return 2;
			case 'G': return 3;
			case 'T': return 4;
		}
		return -1;
	}
	auto H1(long long key) const {
		return key % kTableMax;
	}
	auto H2(long long key) const {
		return 1 + (key % (kTableMax - 1));
	}
	auto Hash(long long key, long long i) const {
		return (H1(key) + i * H2(key)) % kTableMax;
	}
	auto SToKey(const string &s) const {
		int sum = 0;
		int p = 1;
		for (int i = 0; i < s.size(); i++ ){
			sum += p * CToKey(s[i]);
			p *= 5;
		}
		return sum;
	}
	void Insert(const string& s) {
		auto key = SToKey(s);
		for (long long i = 0; i < kTableMax; ++i) {
			long long j = Hash(key, i);
			if (m_Table[j].empty()) {
				m_Table[j] = s;
				return;
			}
		}
	}
	bool Search(const string& s) const {
		auto key = SToKey(s);
		for (long long i = 0; i < kTableMax; ++i) {
			long long j = Hash(key, i);
			if (m_Table[j].empty()) {
				return false;
			} else if (m_Table[j] == s) {
				return true;
			}
		}
		return false;
	}
private:
	string m_Table[kTableMax];
};

signed main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);

	unique_ptr<HashTable> h = make_unique<HashTable>();
	auto size = read();
	REP(i, size) {
		auto command = readS();
		if (command == "insert") {
			h->Insert(readS());
		} else if (command == "find") {
			bool is_in = h->Search(readS());
			println(is_in ? "yes" : "no");
		}
	}
	return 0;
}



Measured memory_bytes: 37708