#include "partition.h"
#include<iostream>
#include<vector>
#include <map>
using namespace std;
int long long sum,n,b[2001000],s,s1,t1,s2,s3,a[2001000],i1,i2;
vector<int> solve(vector<int> A)
{
    vector<int>sol;
    n=0;
    sol.clear();
    while (A.size()) n++,A.pop_back();
    i1=i2=0;

    for (int i=1; i<=n/2-(n/2)%2; i++)
    if (i%2==1) a[++i1]=i,a[++i1]=n-i+1;
    else b[++i2]=i,b[++i2]=n-i+1;

    if (n%4==1) a[++i1]=n/2+1;
    else if (n%4==2) a[++i1]=n/2+1,b[++i2]=n/2;
    else if (n%4==3) a[++i1]=n/2,a[++i1]=n/2+1,b[++i2]=n/2+2;

    for (int i=1; i<=i1; i++)
    sol.push_back(a[i]-1);

    for (int i=1; i<=i2; i++)
    sol.push_back(b[i]-1);

    return sol;
}
/*
int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin >> t ;
    for (int test=1; test<=t; test++) {
        int n;
        cin >> n ;
        vector <int> a(n);
        for (int i=0; i<n; i++) {
            cin >> a[i] ;
        }

        for (auto ind : solve(a)) {
            cout << ind << " ";
        }
        cout << endl ;
    }
    cout << endl ;
    return 0;
}
*/
