#2326 IP Converter

27  1 s   128 MB  


A computer connected to the internet is identified by an IP address. The most common way of displaying an IP address is the dotted quad method: four eight-bit (0-255 in base ten) numbers separated by periods.

Someone has given you a possible IP address, but the periods have been removed, leaving only a string of digits. IP Converter with a method possible Addresses that takes a String ambiguous IP containing the digits and prints a String[] containing all the possible IP addresses that can be formed from those digits by inserting three periods to form a dotted quad.

The numbers in each of the four positions can have any integer value between zero and 255, inclusive. However, a number may not have leading zeroes. For example, the digits 1902426 can form,,, and other IP addresses. However, it cannot form


First line,  a number of test cases T( T <= 50)

Next line, ambiguous IP will contain between 1 and 50 characters.

Each character of ambiguous IP will be between '0' and '9', inclusive.


Print value lexicographically, the elements of the all possible IP addresses, using their string ordering (the period character precedes all digit characters).

if you cannot find possible IP addresses, print the IMPOSSIBLE.

End of each test case, print the newline.

Sample Input

Sample Output





Topcoder Single Round Match 210 Round 1 - Division I, Level One