#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, i = 0;
    cin >> n;
    vector<int> v(n);
    for (i = 0; i < n; i++) cin >> v[i];
    reverse(v.begin(), v.end());
    for (int i = 0; i < n; i++) cout << v[i] << " ";
    cout << "\n";
  }
}
