DCEPC11G - Game of Words

no tags 

Pranjali and Nancy are 2 little sisters. They are learning elementary English at their school. Recently, they learnt about word formation from alphabets and sentence formation using these words. They were so excited with this lesson that they actually played all sort of word games this whole week. And so their friend Sameer felt left out the whole week. So he, in revenge, has challenged Pranjali and Nancy to another word game. The game is as follows:

  • Sameer gives a sentence consisting of words formed by alphanumeric and words are separated by any number of spaces. Let’s say for example: “WoRD2 w0rd3 worD4 120” is a valid sentence (quotes for clarity). The sentence will contain at least a single word.
  • Pranjali and Nancy have to form a sentence which contains the reverse order of the words in the original sentence. Also, the newly formed sentence should have no leading or trailing spaces and words should be separated by a single space character.

Can you help the sisters? Or Sameer will succeed in his unnecessary revenge.

Input

First line contains an integer T, the number of test cases.

Each test case consists of only a single line containing a sentence.

Output

Output T lines, each containing the newly formed sentence as explained above.

Constraints

1 <= T <= 10

Length of a sentence will not exceed 10^5 characters. There will be no empty lines in between test cases.

Example

Input:
2
     WoRD2 w0rd3    worD4 120
 we ARE    S00Ry    saMEErA       

Output:
120 worD4 w0rd3 WoRD2
saMEErA S00Ry ARE we


Added by:dce coders
Date:2013-10-01
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C C++ 4.3.2 CPP JAVA