#include <bits/stdc++.h>
using namespace std;
std::vector<int> findKey(std::vector<int>);
int main() {
  int n = 0, nums = 0, input;
  std::vector<int> prelimVec;
  cin >> n;
  while (n > 0) {
    cin >> nums;
    while (nums > 0) {
      cin >> input;
      prelimVec.push_back(input);
      --nums;
    }
    std::reverse(prelimVec.begin(), prelimVec.end());
    for (int x = 0; x < prelimVec.size(); ++x) {
      cout << prelimVec.at(x) << " ";
    }
    cout << endl;
    prelimVec.clear();
    --n;
  }
}
