#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <functional>
#include <set>
#include <queue>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <cassert>
class Set {
private:
std::vector<int64_t> set;
public:
Set() = default;
explicit Set(const std::vector<int64_t>& v) {
for (const auto &item: v) {
this->Add(item);
}
}
std::vector<int64_t> Data() const {
return this->set;
}
void Add(int64_t num) {
if (!this->Contains(num)) {
this->set.push_back(num);
}
}
void Remove(int64_t num) {
this->set.erase(find(this->set.begin(), this->set.end(), num));
}
bool Contains(int64_t num) const {
return find(this->set.begin(), this->set.end(), num)
!= this->set.end();
}
Set Union(const Set& other) const {
Set s;
for (const auto &item: this->Data()) {
s.Add(item);
}
for (const auto &item: other.Data()) {
s.Add(item);
}
return s;
}
Set Intersection(const Set& other) const {
Set s;
for (const auto &item: other.Data()) {
if (this->Contains(item)) {
s.Add(item);
}
}
return s;
}
Set Difference(const Set& other) const {
Set s;
for (const auto &item: this->Data()) {
if (!other.Contains(item)) {
s.Add(item);
}
}
return s;
}
Set SymmetricDifference(const Set& other) const {
Set s;
s = this->Difference(other);
s = s.Union(other.Difference(*this));
return s;
}
};