Longest Decreasing Suffix

No attempts yetTime limit1sMemory limit128 MB

Problem

Sam has found a possible communication pathway to the outside world, apparently left open by Clu, but he needs the correct password to check whether it still works. Clu cannot remember the passwords to the millions of gates in the Grid, so he usually writes them down somewhere nearby. He never writes a password down directly, though: he encodes it inside several strings written on the wall next to the gate. The first step in decoding the password is to find the longest decreasing suffix (LDS) of every string on the wall. Sam can handle the rest, but he needs your help with this first step.

A decreasing suffix of a string is a suffix in which each character is strictly larger than the character that follows it. The LDS of a string is the longest such suffix. For example, the LDS of abcdbca is ca, and the LDS of abcdljksdflkjzfcba is zfcba.

Input

The first line contains the number of test cases ($\le 50$). Each of the following lines contains one input string of length $< 100$. Every input string consists only of lowercase letters a through z.

Output

For each test case, find the longest decreasing suffix of the input string and print one line in the following format:

The longest decreasing suffix of <string> is <suffix>

where <string> is the input string and <suffix> is its LDS.