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.
Input

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.

Output

For 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

ExamplesInput
2
1
5
Output
-1
21200

加入题单

算法标签: