CF1714C.Minimum Varied Number

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Minimum Varied Number

Find the minimum number with the given sum of digits ss such that all digits in it are distinct (i.e. all digits are unique).

For example, if s=20s=20, then the answer is 389389. This is the minimum number in which all digits are different and the sum of the digits is 2020 (3+8+9=203+8+9=20).

For the given ss print the required number.

Input

The first line contains an integer tt (1t451 \le t \le 45) — the number of test cases.

Each test case is specified by a line that contains the only integer ss (1s451 \le s \le 45).

Output

Print tt integers — the answers to the given test cases.

Samples

4
20
8
45
10
389
8
123456789
19

在线编程 IDE

建议全屏模式获得最佳体验