#include <bits/stdc++.h>

#define pb push_back
#define fi first
#define sc second

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int N = 2e6 + 5;
const ll inf = 1e16;

bool taken[N];
int lst[1<<26];

vector<int> solve(vector<int> a) {
    vector<int> ans;
    int n = a.size();
    
    vector<int> y;
    int l = 0, r = n - 1;
    while(r - l + 1 >= 4) {
        ans.pb(l);
        ans.pb(r);
        l++, r--;
        y.pb(l);
        y.pb(r);
        l++, r--;
    }
    if(r - l + 1 == 1)
        ans.pb(l);
    else if(r - l + 1 == 2)
        ans.pb(r), ans.pb(l);
    else if(r - l + 1 == 3) {
        ans.pb(l);
        ans.pb(r);
        ans.pb(l+1);
    }

    for(auto idk : y)
        ans.pb(idk);
    return ans;
}

#ifndef EVAL
int32_t main() {
    freopen("test.in", "r", stdin);
    freopen("test.out", "w", stdout);
    cin.tie(nullptr)->sync_with_stdio(0);

    int tt;
    cin >> tt;
    while(tt--) {
        vector<int> a;
        int n;
        cin >> n;
        for(int i=1; i<=n; i++) {
            int x;
            cin >> x;
            a.pb(x);
        }
        vector<int> res = solve(a);

        //assert(abs(pax-(n-pax)) <= 1);
        for(auto x : res)
            cout << x << ' ';
        cout << '\n';

    }
    return 0;
}
#endif