#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
using vi = vector<int>;
using vi64 = vector<int64>;
using mii = map<int, int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vpii = vector<pii>;
const int inf = 2e9 + 7;
const char nwl = '\n';
const int mxx = 1e6 + 3;
int64 sumV(vi &v) {
  int64 s = 0;
  for (int x : v) {
    s += (int64)x;
  }
  return s;
}
int gcd(int a, int b) {
  if (!b) return a;
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tt;
  cin >> tt;
  while (tt--) {
    int n;
    cin >> n;
    vi v(n);
    for (auto &x : v) cin >> x;
    int k = 1;
    for (int i = n - 1; i >= 0; i--) {
      cout << v[i] << " ";
    }
    cout << nwl;
  }
  return 0;
}
