#include "partition.h"
#include "map"

std::vector<int> solve(std::vector<int> A) {
    std::map<int,int> vf;
    int st = 1,dr = A.size();

    std::vector<int> rez(A.size());

    for (int i=0; i<A.size(); i++) {
        if (vf[A[i]]%2 == 0) {
            rez[i] = dr--;
        }
        else {
            rez[i] = st++;
        }
    }

    return rez;
}