#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;
int hashC(int key, int a, int p) {
return ((key * a) % p) % 100000;
}
int main() {
ifstream file;
ofstream out;
file.open("set.in");
out.open("set.out");
vector<int> *hash_table = nullptr;
hash_table = new vector<int>(100000);
string command;
int number;
int size;
int index;
int found = 0;
while (file >> command) {
file >> number;
if (command == "insert") {
index = hashC(number, 21, 37);
hash_table[hashC(number, 21, 37)].push_back(number);
}
if (command == "delete") {
size = hash_table[hashC(number, 21, 37)].size();
index = hashC(number, 21, 37);
for (int i = 0; i < size; i++) {
if (hash_table[index][i] == number) {
hash_table[index].erase(hash_table[index].begin() + i);
continue;
}
}
}
if (command == "exists") {
index = hashC(number, 21, 37);
size = hash_table[index].size();
for (int i = 0; i < size; i++) {
if (hash_table[index][i] == number) {
found = 1;
out << "true" << endl;
continue;
}
}
if(found == 0){
out << "false" << endl;
}
found = 0;
}
}
delete hash_table;
return 0;
}