#Lutece0668. Kalindrome
Kalindrome
Migrated from Lutece 668 Kalindrome
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
A palindromic number is a number that remains the same when its digits are reversed. Like 16461
, for example, it is "symmetrical".
Now Krolia want to know the -largest palindromic number which is smaller than .
Input
There is only one integer () in the first line, indicating the number of test cases.
Every test cases contains two integers (), ().
Output
For every test cases, just output a the -largest palindromic number in one line. If this number doesn't exist, output .
Samples
5
10 1
1 1
1 2
100 1
112 2
9
0
-1
99
101
Resources
KroliaFansClub