#include <bits/stdc++.h>
using namespace std;
vector<int> solve(vector<int> A){
    vector<int> perm;
    int n = A.size();
    if(n==1){
        return {0};
    }
    vector<int> first,second, ans;
    for(int i=0; i<n/2; i++){
        if(i%2==0){
            first.push_back(i);
            first.push_back(n-i-1);
        }
        else{
            second.push_back(i);
            second.push_back(n-i-1);
        }
    }
    for(auto x : first){
        ans.push_back(x);
    }
    if(n%2==1){
        ans.push_back(n/2);
    }
    for(auto x : second){
        ans.push_back(x);
    }
    if(n%2==0){
        n--;
        long long z = n/2;
        swap(ans[z],ans[z+1]);
    }
    return ans;
}
/*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;
}*/
