#include <bits/stdc++.h>
using namespace std;
vector<long long int> seve(1000001, 1);
void create_seve() {
  seve[0] = 0;
  seve[1] = 0;
  for (long long int i = 2; i <= 1000000; i++) {
    for (long long int j = 2; j * j <= i; j++) {
      if (i % j == 0) {
        seve[i] = 0;
        break;
      }
    }
  }
}
bool is_prime(long long int n) { return seve[n]; }
vector<pair<long long int, long long int>> prime_factorization(
    long long int n) {
  vector<pair<long long int, long long int>> pf;
  for (long long int i = 2; i * i <= n; i++) {
    long long int c = 0;
    while (n % i == 0) {
      c++;
      n /= i;
    }
    if (c != 0) pf.push_back(make_pair(i, c));
  }
  if (n > 1) pf.push_back(make_pair(n, 1));
  return pf;
}
long long int gcd(long long int a, long long int b) {
  return b == 0 ? a : gcd(b, a % b);
}
unsigned long long int power(unsigned long long int a,
                             unsigned long long int n) {
  unsigned long long int ans = 1;
  while (n > 0) {
    if (n & 1) {
      ans *= a;
    }
    a *= a;
    n = n >> 1;
  }
  return ans;
}
unsigned long long int modulo_power(unsigned long long int a,
                                    unsigned long long int n,
                                    unsigned long long int m) {
  unsigned long long int ans = 1;
  while (n > 0) {
    if (n & 1) {
      ans = (ans * a) % m;
    }
    a = (a * a) % m;
    n = n >> 1;
  }
  return ans % m;
}
long long int sumofdig(long long int ds) {
  long long int ans = 0;
  while (ds) {
    ans += ds % 10;
    ds = ds / 10;
  }
  return ans;
}
bool compare(pair<long long int, long long int> i,
             pair<long long int, long long int> j) {
  return i.second < j.second;
}
void solve4() {
  long long int n;
  cin >> n;
  vector<long long int> v;
  for (long long int i = 0; i < n; i++) {
    long long int a;
    cin >> a;
    v.push_back(a);
  };
  map<long long int, long long int> m;
  for (long long int i = 0; i < n; i++) {
    m[v[i]] = 0;
  }
  for (long long int i = 0; i < n; i++) {
    for (long long int j = i + 1; j < n; j++) {
      if (v[i] - v[j] == j - i) {
        m[v[i]]++;
      }
    }
  }
  for (auto it = m.begin(); it != m.end(); it++)
    cout << it->first << " " << it->second << endl;
  ;
  cout << endl;
  pair<long long int, long long int> ans2 =
      *max_element(m.begin(), m.end(), compare);
  pair<long long int, long long int> ans1 =
      *min_element(m.begin(), m.end(), compare);
  cout << ans1.second + 1 << " " << ans2.second + 1 << endl;
}
void solve() {
  long long int n;
  cin >> n;
  vector<long long int> v, v1;
  for (long long int i = 0; i < n; i++) {
    long long int a;
    cin >> a;
    v.push_back(a);
  };
  for (long long int i = n - 1; i > -1; i--) {
    cout << v[i] << " ";
  }
  cout << endl;
}
int main() {
  long long int w;
  cin >> w;
  while (w--) {
    solve();
  }
  return 0;
}
