#include <vector>
#include <algorithm>

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

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