#include "partition.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

vector<int> solve(vector<int> A) {
    int n = A.size();
    vector<int> rez1, rez2, cnt(3 * 1e7, 0);

    for(int i = 0; i < n; i++) {
        if (cnt[A[i]] % 2 == 0) {
            rez1.push_back(i);
            cnt[A[i]]++;
        } else if (cnt[A[i]] % 2 == 1) {
            rez2.push_back(i);
            cnt[A[i]]++;
        }
    }

    vector<int> rez;
    for (int x : rez1) rez.push_back(x);
    for (int x : rez2) rez.push_back(x);

    return rez;
}
