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