stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstring>

using namespace std;



const int M = 1000000 + 5;

const int L = 14;



char H[M][L];



int getChar(char c){

  if(c == 'A')return 1;

  else if(c == 'C')return 2;

  else if(c == 'G')return 3;

  else if(c == 'T')return 4;

  else return 0;

}



long long getKey(char str[]){

  int len = strlen(str);

  long long sum = 0,p = 1;

  for(int i = 0;i < len; i++){

    sum += p*getChar(str[i]);

    p *= 5;

  }

  return sum;

}



int h1(int key){

  return key % M;

}



int h2(int key){

  return 1 + (key % (M - 1));

}



void insert(char str[]){

  long long key = getKey(str);

  for(int i = 0;; i++){

    int h = (h1(key) + i*h2(key))%M;

    if(strcmp(H[h],str) == 0)return;

    if(strlen(H[h]) == 0){

      strcpy(H[h],str);

      return ;

    }

  }

  return;

}



bool find (char str[]){

  long long key = getKey(str);

  for(int i = 0;; i++){

    int h = (h1(key) + i*h2(key))%M;

    if(strcmp(H[h],str) == 0)return true;

    else if(strlen(H[h]) == 0)return false;

  }

  return false;

}



int main(){

  int n;

  scanf("%d",&n);

  for(int i = 1;i <= n; i++){

    char s1[8],s2[14];

    scanf("%s%s",s1,s2);

    if(s1[0] == 'i'){

      insert(s2);

    }

    else{

      if(find(s2)){

        printf("yes\n");

      }

      else {

        printf("no\n");

      }

    }

  }

}

// Faster C++ solution for the same problem (measured speedup: 5.1594945666892364x):
/*

//alds1_4_c:Dictionary

//算法:开放地址法散列表

//Time: 2018/1/8 星期一

*/

#include<stdio.h>

#include<string.h>



const int M=1000003;

const int L=14;



char H[M][L];



//对于每个字符返回的定义值

int getChar(char ch){

    if(ch=='A') return 1;

    if(ch=='C') return 2;

    if(ch=='D') return 3;

    if(ch=='T') return 4;

    return 0;

}

//对于字符串返回的初始散列值

long long getKey(char str[]){

    long long len=strlen(str),sum=0,p=1;

    for(int i=0;i<len;++i){

        sum+=p*getChar(str[i]);

        //每次获取定义值后p*5,相当于转换成五进制,不会冲突

        p*=5;

    }

    return sum;

}



//开放式散列值计算式: h(k,i)=(h1(k)+i*h2(k))%M

int h1(int key){

    return key%M;

}

//为了保证不会递归冲突(即往下算结果始终相同),必须使h2(key)与M互素

//TLE最好的情况就是改这个函数= =

//目前可以AC的: 1+(key%(M-1))

//(1+key)%(M-1)

int h2(int key){

    return (1+key)%(M-1);

}



//查找

//-1表示找到

//h表示找到第一个可插入点

int find(char str[]){

    long long key=getKey(str),i,h;

    for(i=0;;++i){

        h=(h1(key)+i*h2(key))%M;

        if(strcmp(H[h],str)==0) return -1;

        else if(strlen(H[h])==0) return h;

    }

    return 0;

}



//插入

void insert(char str[]){

    int key=find(str);

    if(key!=-1) strcpy(H[key],str);

}



int main(){

    for(int i=0;i<M;++i) H[M][0]='\0';

    char str[L],com[L];

    int n;

    scanf("%d",&n);

    for(int i=0;i<n;++i){

        scanf("%s %s",com,str);



        if(com[0]=='i'){

            insert(str);

        }else{

            if(find(str)==-1)

                printf("yes\n");

            else

                printf("no\n");

        }

    }



    return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<cstdlib>

#include<cmath>

#include<cstring>

#include<iostream>

#include<algorithm>

#include<queue>

#include<map>

#include<vector>

#include<stack>

#include<list>



typedef long long ll;



using namespace std;



char H[1046527][15];



int getCharKey(char a){

	if(a == 'A')

		return 1;

	else if(a == 'C'){

		return 2;

	}

	else if(a == 'G'){

		return 3;

	}

	else if(a == 'T'){

		return 4;

	}

	else

		return 0;

}



ll getKey(char a[]){

	ll sum = 0;

	ll p = 1;

	for(ll i = 0 ; i<strlen(a) ; i++){

		sum += p*getCharKey(a[i]);

		p *=5;

	}

	return sum;

}



int h1(int key){

	return key%1046527;

}

int h2(int key){

	return 1+ (key%1046526);

}



int insert(char a[]){

	ll key = getKey(a);

	for(ll i = 0 ; ; i++){

		ll h = (h1(key) + i*h2(key)) %1046527;

		if(strcmp(H[h] , a) == 0)

			return 1;

		else if(strlen(H[h]) == 0){

			strcpy(H[h] , a);

			return 0;

		}

	}

	return 0;

}



int find(char a[]){

	ll key = getKey(a);

	for(ll i = 0 ; ; i++){

		ll h = (h1(key) + i*h2(key)) %1046527;

		if(strcmp(H[h] , a) == 0)

			return 1;

		else if(strlen(H[h]) == 0)

			return 0;

	}

	return 0; 

}

int main(){

	ios::sync_with_stdio(false);

	int n;

	cin>>n;

	for(int i = 0 ; i<n ; i++)

		H[i][0] = '\0';

	

	char a[20] , b[20];

	for(int i = 0 ; i<n ; i++){

		cin>>a>>b;

		if(a[0] == 'i')

			insert(b);

		else{

			if(find(b))

				cout<<"yes"<<endl;

			else

				cout<<"no"<<endl;

		}

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.247564110589601x):
/*

//alds1_4_c:Dictionary

//算法:开放地址法散列表

//Time: 2018/1/8 星期一

*/

#include<stdio.h>

#include<string.h>



const int M=1000003;

const int L=14;



char H[M][L];



//对于每个字符返回的定义值

int getChar(char ch){

    if(ch=='A') return 1;

    if(ch=='C') return 2;

    if(ch=='D') return 3;

    if(ch=='T') return 4;

    return 0;

}

//对于字符串返回的初始散列值

long long getKey(char str[]){

    long long len=strlen(str),sum=0,p=1;

    for(int i=0;i<len;++i){

        sum+=p*getChar(str[i]);

        //每次获取定义值后p*5,相当于转换成五进制,不会冲突

        p*=5;

    }

    return sum;

}



//开放式散列值计算式: h(k,i)=(h1(k)+i*h2(k))%M

int h1(int key){

    return key%M;

}

//为了保证不会递归冲突(即往下算结果始终相同),必须使h2(key)与M互素

//TLE最好的情况就是改这个函数= =

//目前可以AC的: 1+(key%(M-1))

//(1+key)%(M-1)

int h2(int key){

    return (1+key)%(M-1);

}



//查找

//-1表示找到

//h表示找到第一个可插入点

int find(char str[]){

    long long key=getKey(str),i,h;

    for(i=0;;++i){

        h=(h1(key)+i*h2(key))%M;

        if(strcmp(H[h],str)==0) return -1;

        else if(strlen(H[h])==0) return h;

    }

    return 0;

}



//插入

void insert(char str[]){

    int key=find(str);

    if(key!=-1) strcpy(H[key],str);

}



int main(){

    for(int i=0;i<M;++i) H[M][0]='\0';

    char str[L],com[L];

    int n;

    scanf("%d",&n);

    for(int i=0;i<n;++i){

        scanf("%s %s",com,str);



        if(com[0]=='i'){

            insert(str);

        }else{

            if(find(str)==-1)

                printf("yes\n");

            else

                printf("no\n");

        }

    }



    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <map>

using namespace std;



int main(){

	int n;cin >> n;

	string s, str;

	map<string, int> m;

	for(int i = 0;i < n;i++){

		cin >> s >> str;

		if(s[0] == 'i'){

			m[str] = 1;

		}else{

			if(m[str])cout << "yes" << endl;

			else cout << "no" << endl;

		}

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.370435327483436x):
#include <cstdio>

#include <cstring>

using namespace std;

bool d[33554432];

char k[128];





int c(char str[12]){

	int ans = str[0];

	for(int i = 1;i < strlen(str);i++){

		ans <<= 2;

		ans += k[str[i]];

	}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	for(int i = 0;i < n;i++){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <map>

#include <cstdio>

using namespace std;



int main(){

	int n;scanf("%d", &n);

	char s[7], str[13];

	map<string, int> m;

	for(int i = 0;i < n;i++){

		scanf("%s %s", s, str);

		if(s[0] == 'i')m[str] = 1;

		else puts(m[str] ? "yes" : "no");

	}

	return 0;

}

//1.78

// Faster C++ solution for the same problem (measured speedup: 5.248699866629152x):
#include <cstdio>

#include <cstring>

using namespace std;

bool d[33554432];

char k[128];





int c(char str[12]){

	int ans = str[0];

	for(int i = 1;i < strlen(str);i++){

		ans <<= 2;

		ans += k[str[i]];

	}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	for(int i = 0;i < n;i++){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <map>

#include <cstdio>

using namespace std;



int main(){

	int n;scanf("%d", &n);

	char s[7], str[13];

	map<string, bool> m;

	for(int i = 0;i < n;i++){

		scanf("%s %s", s, str);

		if(s[0] == 'i')m[str] = true;

		else puts(m[str] ? "yes" : "no");

	}

	return 0;

}

//1.78

//0.87

// Faster C++ solution for the same problem (measured speedup: 5.2487214180717725x):
#include <cstdio>

#include <cstring>

using namespace std;

bool d[33554432];

char k[128];





int c(char str[12]){

	int ans = str[0];

	for(int i = 1;i < strlen(str);i++){

		ans <<= 2;

		ans += k[str[i]];

	}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	for(int i = 0;i < n;i++){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <map>

using namespace std;



int main(){

	int n;cin >> n;

	string s, str;

	map<string, int> m;

	for(int i = 0;i < n;i++){

		cin >> s >> str;

		if(s[0] == 'i'){

			m[str] = 1;

		}else{

			if(m[str])cout << "yes" << endl;

			else cout << "no" << endl;

		}

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.105407953785889x):
#include <cstdio>

#include <cstring>

#include <map>

using namespace std;

bool d[33554432];

map<char, int> k;



int c(char str[12]){

	int ans = str[0];

	for(int i = 1;i < strlen(str);i++){

		ans <<= 2;

		ans += k[str[i]];

	}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	for(int i = 0;i < n;i++){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <map>

using namespace std;



int main(){

	int n;cin >> n;

	string s, str;

	map<string, int> m;

	for(int i = 0;i < n;i++){

		cin >> s >> str;

		if(s[0] == 'i'){

			m[str] = 1;

		}else{

			if(m[str])cout << "yes" << endl;

			else cout << "no" << endl;

		}

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.365784370278972x):
#include <cstdio>

#include <cstring>

using namespace std;

bool d[33554432];

char k[128];



int c(char str[12]){

	int ans = str[0];

	for(int i = 1;i < strlen(str);i++){

		ans <<= 2;

		ans += k[str[i]];

	}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	while(n--){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <map>

#include <cstdio>

using namespace std;



int main(){

	int n;scanf("%d", &n);

	char s[7], str[13];

	map<string, int> m;

	for(int i = 0;i < n;i++){

		scanf("%s %s", s, str);

		if(s[0] == 'i')m[str] = 1;

		else puts(m[str] ? "yes" : "no");

	}

	return 0;

}

//1.78

// Faster C++ solution for the same problem (measured speedup: 5.2441543359653995x):
#include <cstdio>

#include <cstring>

using namespace std;

bool d[33554432];

char k[128];



int c(char str[12]){

	int ans = str[0];

	for(int i = 1;i < strlen(str);i++){

		ans <<= 2;

		ans += k[str[i]];

	}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	while(n--){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <map>

#include <cstdio>

using namespace std;



int main(){

	int n;scanf("%d", &n);

	char s[7], str[13];

	map<string, bool> m;

	for(int i = 0;i < n;i++){

		scanf("%s %s", s, str);

		if(s[0] == 'i')m[str] = true;

		else puts(m[str] ? "yes" : "no");

	}

	return 0;

}

//1.78

//0.87

// Faster C++ solution for the same problem (measured speedup: 5.244175868743828x):
#include <cstdio>

#include <cstring>

using namespace std;

bool d[33554432];

char k[128];



int c(char str[12]){

	int ans = str[0];

	for(int i = 1;i < strlen(str);i++){

		ans <<= 2;

		ans += k[str[i]];

	}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	while(n--){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <cstring>

#include <map>

using namespace std;

bool d[33554432];

map<char, int> k;



int c(char str[12]){

	int ans = str[0];

	for(int i = 1;i < strlen(str);i++){

		ans <<= 2;

		ans += k[str[i]];

	}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	for(int i = 0;i < n;i++){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.85412136931149x):
#include <cstdio>

#include <cstring>

using namespace std;

bool d[33554432];

char k[128];



int c(char str[12]){

	int ans = str[0];

	for(int i = 1;i < strlen(str);i++){

		ans <<= 2;

		ans += k[str[i]];

	}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	while(n--){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <map>

using namespace std;



int main(){

	int n;cin >> n;

	string s, str;

	map<string, int> m;

	for(int i = 0;i < n;i++){

		cin >> s >> str;

		if(s[0] == 'i'){

			m[str] = 1;

		}else{

			if(m[str])cout << "yes" << endl;

			else cout << "no" << endl;

		}

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.375167844005492x):
#include <cstdio>

using namespace std;

bool d[33554432];

char k[128];



int c(char str[12]){

	int ans = str[0], i = 1;

	for(i;str[i] != '\0';i++){ans <<= 2;ans += k[str[i]];}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	while(n--){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <map>

#include <cstdio>

using namespace std;



int main(){

	int n;scanf("%d", &n);

	char s[7], str[13];

	map<string, int> m;

	for(int i = 0;i < n;i++){

		scanf("%s %s", s, str);

		if(s[0] == 'i')m[str] = 1;

		else puts(m[str] ? "yes" : "no");

	}

	return 0;

}

//1.78

// Faster C++ solution for the same problem (measured speedup: 5.253325107847683x):
#include <cstdio>

using namespace std;

bool d[33554432];

char k[128];



int c(char str[12]){

	int ans = str[0], i = 1;

	for(i;str[i] != '\0';i++){ans <<= 2;ans += k[str[i]];}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	while(n--){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <map>

#include <cstdio>

using namespace std;



int main(){

	int n;scanf("%d", &n);

	char s[7], str[13];

	map<string, bool> m;

	for(int i = 0;i < n;i++){

		scanf("%s %s", s, str);

		if(s[0] == 'i')m[str] = true;

		else puts(m[str] ? "yes" : "no");

	}

	return 0;

}

//1.78

//0.87

// Faster C++ solution for the same problem (measured speedup: 5.253346678281792x):
#include <cstdio>

using namespace std;

bool d[33554432];

char k[128];



int c(char str[12]){

	int ans = str[0], i = 1;

	for(i;str[i] != '\0';i++){ans <<= 2;ans += k[str[i]];}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	while(n--){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <cstring>

#include <map>

using namespace std;

bool d[33554432];

map<char, int> k;



int c(char str[12]){

	int ans = str[0];

	for(int i = 1;i < strlen(str);i++){

		ans <<= 2;

		ans += k[str[i]];

	}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	for(int i = 0;i < n;i++){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.862610066804921x):
#include <cstdio>

using namespace std;

bool d[33554432];

char k[128];



int c(char str[12]){

	int ans = str[0], i = 1;

	for(i;str[i] != '\0';i++){ans <<= 2;ans += k[str[i]];}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	while(n--){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <map>

using namespace std;



int main(){

	int n;cin >> n;

	string s, str;

	map<string, int> m;

	for(int i = 0;i < n;i++){

		cin >> s >> str;

		if(s[0] == 'i'){

			m[str] = 1;

		}else{

			if(m[str])cout << "yes" << endl;

			else cout << "no" << endl;

		}

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.375167844005492x):
#include <cstdio>

bool d[33554432];

char k[128];



int c(char str[12]){

	int ans = str[0], i = 1;

	for(i;str[i] != '\0';i++){ans <<= 2;ans += k[str[i]];}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	while(n--){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <map>

#include <cstdio>

using namespace std;



int main(){

	int n;scanf("%d", &n);

	char s[7], str[13];

	map<string, int> m;

	for(int i = 0;i < n;i++){

		scanf("%s %s", s, str);

		if(s[0] == 'i')m[str] = 1;

		else puts(m[str] ? "yes" : "no");

	}

	return 0;

}

//1.78

// Faster C++ solution for the same problem (measured speedup: 5.253325107847683x):
#include <cstdio>

bool d[33554432];

char k[128];



int c(char str[12]){

	int ans = str[0], i = 1;

	for(i;str[i] != '\0';i++){ans <<= 2;ans += k[str[i]];}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	while(n--){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <map>

#include <cstdio>

using namespace std;



int main(){

	int n;scanf("%d", &n);

	char s[7], str[13];

	map<string, bool> m;

	for(int i = 0;i < n;i++){

		scanf("%s %s", s, str);

		if(s[0] == 'i')m[str] = true;

		else puts(m[str] ? "yes" : "no");

	}

	return 0;

}

//1.78

//0.87

// Faster C++ solution for the same problem (measured speedup: 5.253346678281792x):
#include <cstdio>

bool d[33554432];

char k[128];



int c(char str[12]){

	int ans = str[0], i = 1;

	for(i;str[i] != '\0';i++){ans <<= 2;ans += k[str[i]];}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	while(n--){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <cstring>

#include <map>

using namespace std;

bool d[33554432];

map<char, int> k;



int c(char str[12]){

	int ans = str[0];

	for(int i = 1;i < strlen(str);i++){

		ans <<= 2;

		ans += k[str[i]];

	}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	for(int i = 0;i < n;i++){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.862610066804921x):
#include <cstdio>

bool d[33554432];

char k[128];



int c(char str[12]){

	int ans = str[0], i = 1;

	for(i;str[i] != '\0';i++){ans <<= 2;ans += k[str[i]];}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	while(n--){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <set>

#include <string>

using namespace std;



int main() {

	ios::sync_with_stdio(false);

        cin.tie(0);

	int n;

	cin >> n;

	set<string> st;

	while(n--){

		string order;

		string str;

		

		cin>>order;

		cin>>str;

		

		if(order=="insert"){

			st.insert(str);

		}else{

			if(st.find(str)!=st.end()){

				cout<<"yes"<<endl;

			}else{

				cout<<"no"<<endl;

			}

		}

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.360052791160437x):
#include<cstdio>

#include<cstring>

using namespace std;

#define M 1000000//??????????????°

#define L 12	  //??????????????????



char H[M][L];



//??????????????°???

int getChar(char ch){

	if(ch=='A') return 1;

	else if(ch=='C') return 2;

	else if(ch=='G') return 3;

	else if(ch=='T') return 4;

	else return 0;

}



int getKey(char str[]){

	int sum = 0, p=1, i;

	for(i=0;i<strlen(str);i++){

		sum += p*( getChar(str[i]) );

		p *= 5;

	}

	return sum;

}



int h1(int key){ return key % M; }

int h2(int key){ return 1 + (key % (M-1)); }

int hashfunc(int key,int i){ return ( h1(key) + i*h2(key) ) % M; }



int find(char str[]){

	int key,i,h;

	key = getKey(str);

	for( i=0 ; ; i++ ){

		h = hashfunc(key,i);

		if(strcmp(H[h],str) == 0) return 1;

		else if( strlen(H[h]) == 0 ) return 0;//??°?????£???????????¨???????????¨?????\??£???????????¨???????????¨???

	}

	return 0;

} 



void insert(char str[]){

	int key,i,h;

	key = getKey(str);

	for( i=0 ; ; i++ ){

		h = hashfunc(key,i);

		if(strcmp(H[h],str) == 0) return;

		else if(strlen(H[h]) == 0){

			strcpy(H[h],str);

			return;

		}

	}

	return;

}



int main(){

	int i,n,h;

	scanf("%d",&n);

	for(i = 0;i<n;i++){

		char command[6];

		char str[12];

		scanf("%s%s",command,str);

		if(command[0] == 'i'){

			insert(str);

		}else{

			if(find(str)){

				printf("yes\n");

			}else{

				printf("no\n");

			}

		}

	}

	return 0;

}