#K81107. Next Palindrome Number

    ID: 35680 Type: Default 1000ms 256MiB

Next Palindrome Number

Next Palindrome Number

Given an integer (N), find the smallest palindrome number that is strictly greater than (N). A palindrome is a number that reads the same forwards and backwards.

Input Format: The first line contains an integer (T), representing the number of test cases. Each of the following (T) lines contains a single integer (N).

Your task is to compute, for each test case, the smallest palindrome greater than (N).

inputFormat

Standard input (stdin) will contain multiple lines. The first line contains an integer (T), the number of test cases. Each of the next (T) lines contains one integer (N).

outputFormat

For each test case, output on a separate line the smallest palindrome number that is strictly greater than (N).## sample

5
31
130
999
1
10
33

131 1001 2 11

</p>