#include <bits/stdc++.h>
using namespace std;
string numtostr(long long n) {
  ostringstream str1;
  str1 << n;
  return str1.str();
}
long long strtonum(string s) {
  long long x;
  stringstream str1(s);
  str1 >> x;
  return x;
}
long long GCD(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
  long long gcd = GCD(a, b);
  return (a / gcd) * b;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    if (n % 2 == 1) {
      vector<pair<long long, long long> > v;
      pair<long long, long long> p;
      for (long long i = 1; i <= n - 1; i++) {
        long long a;
        cin >> a;
        if (i % 2 == 0) {
          p.second = a;
          v.push_back(p);
        } else
          p.first = a;
      }
      long long last;
      cin >> last;
      reverse(v.begin(), v.end());
      cout << last << " ";
      for (long long i = 0; i <= v.size() - 1; i++) {
        cout << v[i].second << " " << v[i].first << " ";
      }
      cout << endl;
    } else {
      vector<pair<long long, long long> > v;
      pair<long long, long long> p;
      for (long long i = 1; i <= n; i++) {
        long long a;
        cin >> a;
        if (i % 2 == 0) {
          p.second = a;
          v.push_back(p);
        } else
          p.first = a;
      }
      reverse(v.begin(), v.end());
      for (long long i = 0; i <= v.size() - 1; i++) {
        cout << v[i].second << " " << v[i].first << " ";
      }
      cout << endl;
    }
  }
  return 0;
}
