What a Twist
Time limit1sMemory limit128 MB
Find the maximum of n times its digitwise nine-complement over all integers from 1 to N for each test case.
Problem
The reversal of a positive integer is the number you get by replacing every digit of with .
Zeros that end up in front of the leading significant digit are ignored. So the reversal of 9 is 0, the reversal of 91 is 8, the reversal of 124 is 875, and the reversal of 990 is 9.
The loveliness of is multiplied by .

Given a positive integer , find the largest loveliness among the numbers from 1 to .
Input
The first line contains the number of test cases . ()
Each of the next lines contains one positive integer . ()
Output
For each test case, print on its own line the largest loveliness among the numbers from 1 to . The answer for the -th test case goes on the -th line.
Hint
Both 4 and 5 have loveliness 20, and 100 has loveliness 89900.