![](https://img2018.cnblogs.com/blog/1648545/201907/1648545-20190708115515264-2134941820.png)
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
sc.nextLine();
while (t-- > 0)
{
String str = sc.nextLine();
String []strs = str.split(" ");
String output = "";
for (int i = 0; i < strs.length; i++)
{
for (int j = strs[i].length() - 1; j >= 0; j--)
output += strs[i].charAt(j);
if ((i + 1) == strs.length)
continue;
output += " ";
}
if (str.endsWith(" "))
output += " ";
System.out.println(output);
}
}
}