#include <iostream>
#include <vector>
using namespace std;
int n;
int a[2000000];
int main() {
	int t;
	cin >> t;
	while (t--) {
		cin >> n;
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}
		for (int i = n - 2; i > 0; i -= 4) {
			cout << a[i] << " " << a[i - 1] << " ";
		}
		cout << a[n - 1] << " ";
		for (int i = n - 4; i > 0; i -= 4) {
			cout << a[i] << " " << a[i - 1] << " ";
		}
		cout << a[0];
	}
}