[Solution] Minimum Varied Number solution codeforces

Minimum Varied Number solution codeforces – Find the minimum number with the given sum of digits đť‘ s such that all digits in it are distinct (i.e. all digits are unique).

Table of Contents

[Solution] Minimum Varied Number solution codeforces

For example, if 𝑠=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 𝑠s print the required number.

Input

The first line contains an integer 𝑡t (1≤𝑡≤451≤t≤45) — the number of test cases.

Each test case is specified by a line that contains the only integer 𝑠s (1≤𝑠≤451≤s≤45).

Output

Print 𝑡t integers — the answers to the given test cases.

[Solution] Minimum Varied Number solution codeforces

Example
input

Copy
4
20
8
45
10
output

Copy
389
8
123456789
19

 

For Solution

“Click Here

Leave a Comment