#include <iostream>
#include <vector>

class Set {
 public:
    std::vector<int64_t> v;

    explicit Set(const std::vector<int64_t>& v) {
        this->v = v;
    }
     Set() {
    }

    std::vector<int64_t> Data() const {
        return this->v;
    }

    void Add(int64_t number) {
        bool is_new = true;
        for ( unsigned int i = 0; i < this->v.size(); i++)
            if (number == this->v[i]) {
                is_new = false;
                break;
            }
        if (is_new) this->v.push_back(number);
    }

    void Remove(int64_t number) {
        for (unsigned int i = 0; i < this->v.size(); i++)
            if (this->v[i] == number) {
                this->v.erase(this->v.begin() + i);
                break;
            }
    }

    bool Contains(int64_t number) const {
        for (unsigned int i = 0; i < this->v.size(); i++)
            if (this->v[i] == number) return true;
        return false;
    }

    Set Union(const Set& other) const {
        auto this_set = Data();
        auto other_set = other.Data();
        int size_other = other_set.size();
        int this_size = this_set.size();
        std::vector<int64_t> new_v;
        bool is_new = true;
        for (int i = 0; i < this_size; i++)
            new_v.push_back(this_set[i]);
        for (int i = 0; i < size_other; i++) {
            is_new = true;
            for (int j = 0; j < this_size; j++) {
                if (other_set[i] == this_set[j]) {
                    is_new = false;
                    break;
                }
            }
            if (is_new == true) new_v.push_back(other_set[i]);
        }
        return Set(new_v);
    }

    Set Intersection(const Set& other) const {
        auto this_set = Data();
        auto other_set = other.Data();
        int size_other = other_set.size();
        int this_size = this_set.size();
        std::vector<int64_t> new_v;
        for (int i = 0; i < this_size; i++) {
            for (int j = 0; j < size_other; j++) {
                if (other_set[j] == this_set[i]) {
                    new_v.push_back(this_set[i]);
                    break;
                }
            }
        }
        return Set(new_v);
    }

    Set Difference(const Set& other) const {
        auto this_set = Data() > other.Data() ? Data() : other.Data();
        auto other_set = Data() < other.Data() ? Data() : other.Data();
        int size_other = other_set.size();
        int this_size = this_set.size();
        bool is_different = true;
        std::vector<int64_t> new_v;
        for (int i = 0; i < this_size; i++) {
            is_different = true;
            for (int j = 0; j < size_other; j++) {
                if (other_set[j] == this_set[i]) {
                    is_different = false;
                    break;
                }
            }
            if (is_different)
                new_v.push_back(this_set[i]);
        }

        return Set(new_v);
    }

    Set SymmetricDifference(const Set& other) const {
        auto this_set = Data();
        auto other_set = other.Data();
        int size_other = other_set.size();
        int this_size = this_set.size();
        std::vector<int64_t> new_v;
        for (int i = 0; i < this_size; i++) {
            if (!other.Contains(this_set[i])) new_v.push_back(this_set[i]);
        }
        for (int i = 0; i < size_other; i++) {
            if (!Contains(other_set[i])) new_v.push_back(other_set[i]);
        }
        return Set(new_v);
    }
};