#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include "partition.h"

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ar array
#define int long long
#define all(v) v.begin(), v.end()

const int N = 1e5 + 20;
const int MOD = 1e9 + 7;
const int INF = 1e16;

template<typename T>
void chmin(T &a, T b){a = min(a, b);};
template<typename T>
void chmax(T &a, T b){a = max(a, b);};
template<typename T>
void mm(T &x){
    x %= MOD;
    if (x < 0) x += MOD;
};

std::vector<signed> solve(std::vector<signed> A) {
    vector<int> P, Q;

    map<int,int> mp;
    for (int i = 0;i < A.size();i++) {
        mp[A[i]]++;
        if (mp[A[i]] % 2)P.push_back(i);
        else Q.push_back(i);
    }
    vector<signed> ans;
    for (auto u: P)ans.push_back(u);
    for (auto u: Q)ans.push_back(u);
    return ans;
}


#define int signed