#include "partition.h"
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;
const int N = 2e6 + 67;

#define all(X) (X).begin(), (X).end()
#define ff first
#define ss second

bool used[N];
pair<int, int>a[N];

std::vector<int> solve(std::vector<int> A) 
{
	int n = A.size();
	for (int i = 0; i < n; i++)
		a[i + 1] = { A[i], i };
	sort(a + 1, a + 1 + n);
	vector<int>answ;
	bool flag = true;

	for (int i = 1; i <= n; i += 2)
	{
		flag &= (a[i].ff == a[i + 1].ff);
	}

	if (flag)
	{
		for (int i = 1; i <= n; i += 2)
		{
			answ.push_back(a[i].ss);
		}
		for (int i = 2; i <= n; i += 2)
		{
			answ.push_back(a[i].ss);
		}
		return answ;
	}
	flag = (n <= 25);
	for (int i = 1; i <= n; i++)
	{
		if (a[i].ff != (1 << (i - 1)))
		{
			flag = false;
			break;
		}
	}
	if (flag)
	{
		for (int i = 1; i <= n; i++)
		{
			answ.push_back(a[i].ss);
		}
	}

	return answ;
}
