#include "partition.h"
#include <bits/stdc++.h>
using namespace std;

std::vector<int> solve(std::vector<int> A) {
    int n = A.size();
    vector<pair<int, int>> f, s;
    map<int, int> c;
    for (int i = 0; i < n; i++) {
        int x = A[i];
        if (c[x] & 1) {
            s.push_back({x, i});
        }
        else {
            f.push_back({x, i});
        }
        c[x]++;
    }
    vector<int> fin;
    for (auto [x, i]: f) fin.push_back(i);
    for (auto [x, i]: f) fin.push_back(i);
    return fin;
}
