Problem Statement
This problem is a programming version of Problem 4 from projecteuler.net
A palindromic number reads the same both ways. The smallest 6 digit palindrome made from the product of two 3-digit numbers is101101=143×707 .
Find the largest palindrome made from the product of two 3-digit numbers which is less thanN .
Input Format
First line containsT that denotes the number of test cases. This is followed by T lines, each containing an integer, N .
Output Format
Print the required answer for each test case in a new line.
Constraints
1≤T≤100
101101<N<1000000
Sample Input
A palindromic number reads the same both ways. The smallest 6 digit palindrome made from the product of two 3-digit numbers is
Find the largest palindrome made from the product of two 3-digit numbers which is less than
Input Format
First line contains
Output Format
Print the required answer for each test case in a new line.
Constraints
Sample Input
2
101110
800000
Sample Output 101101
793397