#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)
{
    deque<int> a;
    for(int i = 0; i < A.size(); i++)
    {
        if(x[A[i]] % 2 == 0) a.push_back(A[i]);
        else a.push_front(A[i]);
    }
    vector<int> ans;
    for(int i = 0; i < A.size(); i++)
    {
        ans.push_back(a[i]);
    }
    return ans;
}