#include <vector>
#include <algorithm>

class Set {
 private:
const int FLAGS = 10e9;

 public:
std::vector <int64_t> set;
Set() {
}
Set& operator=(const Set& other) {
this->set = other.set;
return *this;
}
explicit Set(const std::vector<int64_t>& vec) {
std::vector <bool> flags(FLAGS, false);
for (int i = 0; i < vec.size(); i++) {
if (!flags[vec[i]]) {
flags[vec[i]] = true;
this->set.push_back(vec[i]);
}
}
sort(this->set.begin(), this->set.end());
}
Set Union(const Set& join_set) {
std::vector <bool> flags(FLAGS, false);
std::vector <int64_t> new_set;
for (int i = 0; i < join_set.set.size(); i++) {
if (!flags[join_set.set[i]]) {
new_set.push_back(join_set.set[i]);
flags[join_set.set[i]] = true;
}
}
for (int i = 0; i < this->set.size(); i++) {
if (!flags[this->set[i]]) {
new_set.push_back(this->set[i]);
flags[this->set[i]] = true;
}
}
sort(new_set.begin(), new_set.end());
return { new_set };
}
Set Intersection(const Set& s) {
std::vector <int64_t> result;
for (int i = 0; i < join_set.set.size(); i++) {
if (std::find(this->set.begin(), this->set.end(), s.set[i]) != this->set.end()) {
result.push_back(s.set[i]);
}
}
return { result };
}
Set Difference(const Set& join_set) {
std::vector <int64_t> result;
for (int i = 0; i < join_set.set.size(); i++) {
if (std::find(this->set.begin(), this->set.end(), join_set.set[i]) == this->set.end()) {
result.push_back(join_set.set[i]);
}
}
return { result };
}
Set SymmetricDifference(const Set& s) {
std::vector <int64_t> result;
for (int i = 0; i < s.set.size(); i++) {
if (std::find(this->set.begin(), this->set.end(), s.set[i]) == this->set.end()) {
result.push_back(s.set[i]);
}
}
for (int i = 0; i < this->set.size(); i++) {
if (std::find(s.set.begin(), s.set.end(), this->set[i]) == s.set.end()) {
result.push_back(this->set[i]);
}
}
return { result };
}
void Add(int64_t element) {
if (std::find(this->set.begin(), this->set.end(), element) == this->set.end()) {
this->set.push_back(element);
}
}
bool Contains(int64_t element) {
for (int i = 0; i < this->set.size(); i++) {
if (this->set[i] == element) {
return true;
}
}
return false;
}
void Remove(int64_t element) {
for (int i = 0; i < this->set.size(); i++) {
if (this->set[i] == element) {
this->set.erase(this->set.begin() + i);
}
}
}
std::vector <int64_t> Data() {
return this->set;
}
void Print() {
for (auto temp : set) {
std::cout << temp << " ";
}
std::cout << std::endl;
}
};