BETA

Difficulty Level:

Hard

Total Submissions: 394 Accuracy:

10.15%

Numbers with one absolute difference
       

Given a number N. The task is to print all the numbers less than or equal to N in increasing order, with the fact that absolute difference between any adjacent digits of number should be 1.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer N.

Output:
In new line print all the required numbers. if there is no such number less than or equal to N then print "-1".

Constraints:
1<=T<=100
1<=N<=1012

Example:
Input:

2
20
9
Output:
10 12
-1

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Arun tyagi

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.