#include<iostream>
#include"partition.h"
#include<vector>
#include<deque>
#include<unordered_map>
using namespace std;
unordered_map<int, int> x;
vector<int> solve(vector<int> A)
{
    int l = 0;
    int r = A.size() - 1;
    vector<int> ans(A.size()-1);
    for(int i = 0; i < A.size(); i++)
    {
        if(x[A[i]] % 2 == 0)
        {
            ans[l] = A[i];
            l++;
        }
        else
        {
            ans[r] = A[i];
            r--;
        }
        x[A[i]]++;
    }
    return ans;
}