#K50977. Next Palindrome Number

    ID: 28984 Type: Default 1000ms 256MiB

Next Palindrome Number

Next Palindrome Number

You are given an integer M. Your task is to compute the smallest palindromic number that is strictly greater than M. A palindromic number is one that remains the same when its digits are reversed.

The input consists of multiple test cases. For each test case, output the corresponding next palindromic number on a new line.

Note: The number M can be very large (up to hundreds of digits), so make sure your solution handles big integers appropriately.

inputFormat

The first line contains a single integer T denoting the number of test cases. Each of the following T lines contains one non-negative integer M.

outputFormat

For each test case, print the smallest palindromic number that is strictly greater than M. Each answer should be printed on a separate line.

## sample
2
123
808
131

818

</p>