#include <bits/stdc++.h>
using namespace std;
namespace AC {
const long long N = 1e5 + 66;
long long BUGS = 1;
inline long long read() {
  long long x = 0;
  bool flag = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') flag = 0;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  if (flag) return x;
  return (~(x - 1));
}
inline void read(long long arr[], long long s, long long e) {
  for (long long i = s; i <= e; ++i) arr[i] = read();
}
inline void write(long long x) {
  if (x < 0) {
    x = ~(x - 1);
    putchar('-');
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
inline void print(long long x) {
  write(x);
  puts("");
}
inline void print(long long arr[], long long s, long long e) {
  for (long long i = s; i <= e - 1; ++i) write(arr[i]), putchar(' ');
  write(arr[e]);
  puts("");
}
inline long long max3(long long a, long long b, long long c) {
  return max(a, max(b, c));
}
inline long long min3(long long a, long long b, long long c) {
  return min(a, min(b, c));
}
inline void debugNum(long long num, string ss) {
  cout << "BUGS" << BUGS++ << " : " << ss << " : " << num << endl;
}
inline void debugArr(long long arr[], long long s, long long e, string ss) {
  cout << "BUGS" << BUGS++ << " : " << ss << " : " << endl;
  for (long long i = s; i <= e; ++i)
    cout << "i : " << i << " val : " << arr[i] << endl;
}
inline void IO() {
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
}
}  // namespace AC
using namespace AC;
long long n, arr[N];
int main() {
  long long T = read();
  while (T--) {
    n = read(), read(arr, 1, n);
    reverse(arr + 1, arr + 1 + n);
    print(arr, 1, n);
  }
  return 0;
}
