401602: GYM100499 A Cool number
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
A. Cool numbertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
A positive integer X is a cool number if it satisfies the following conditions:
- It has k digits (1 ≤ k ≤ 10), numbered from 1 to k, with the 1st digit being the most significant and the k - th digit being the least significant.
- The value of the i - th digit equals to the number of occurrence of digit i - 1 in X.
For example:
- 21200 is a cool number because it has 2 digits 0, 1 digit 1, 2 digits 2, 0 digit 3, and 0 digit 4.
- 8000000010 is not a cool number because the second digit is 0 but there is one digit 1.
The first line contains an integer T (1 ≤ T ≤ 10) denoting the number of tests. Then T tests follow, each test case consists of only one number k.
OutputFor each test case, print out all the cool numbers in one line in increasing order, separated by a single space. If there is no cool number, output -1
ExamplesInput2Output
1
5
-1
21200