#include <stdio.h> int main() { int t; scanf("%d", &t); while (t--) { int n; scanf("%d", &n); getchar(); char s[100001]; for (int i=0; i<n; i++) { scanf("%c", &s[i]); } for (int i=n-1; i>=0; i--) { if (s[i]!=' ') { printf("%c", s[i]); } } printf("\n"); } return 0; }