#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
int main() {
  int Case;
  scanf("%d", &Case);
  while (Case--) {
    int n;
    int num[maxn];
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
      scanf("%d", &num[i]);
    }
    for (int i = n; i > 1; i--) {
      printf("%d ", num[i]);
    }
    printf("%d\n", num[1]);
  }
  return 0;
}
