#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int N;
    cin >> N;
    vector<int> arr(N);
    for (int i = 0; i < N; i++) {
      cin >> arr[i];
    }
    reverse(arr.begin(), arr.end());
    for (int i = 0; i < N; i++) {
      cout << arr[i];
      cout << ((i == N - 1) ? "\n" : " ");
    }
  }
  return 0;
}
