1222 - Easy or Hard

Time Limit: 1s Memory Limit: 128MB

Submissions: 538 Solved: 212
Description
This is the Fifth Problem in this contest. Maybe this is not an easy one, but I think you are clever enough to solve it. Try your best! As is known to all, most people's name can be divided into two part, one part is the family name and the other part is the given name. In Chinese we write family name before given name, but in English we write the given name first. Now the task is below: Given N names written in Chinese Type, you should change them into English Type.
Input
In the first line, there is an Integer N(1<=N<=1000), which means there are N test cases in the problem. There are N lines followed, each contains two strings and the total length of them is less than 200. The first one is the family name and the second one is the given name.
Output
For each test case, you should output a line contains two strings with a space character between them, the first one is the given name and the second one is the family name. What's more, we all know that the first character of the family name and the given name should be an uppercase one and other characters should be a lowercase one, so if there are mistakes in the strings, you must correct them.
Sample Input
3
Zhang Wei
Wang LiangJing
Zhou Chen
Sample Output
Wei Zhang
Liangjing Wang
Chen Zhou
Hint
Source
Sempr, HUST Programming Contest 2007