#include <bits/stdc++.h>
using namespace std;
void io() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  io();
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int p[n];
    for (int i = 0; i < n; ++i) cin >> p[i];
    for (int i = n - 1; i >= 0; --i) cout << p[i] << " ";
    cout << "\n";
  }
  return 0;
}
