Problem: You are given a positive number x. Find the smallest positive integer number that has the sum of digits equal to x and all digits are distinct (unique).

Input

The first line contains a single positive integer t (1 ≤ t ≤ 50) — the number of test cases in the test. Then t test cases follow.

Each test case consists of a single integer number x (1 ≤ x ≤ 50).

Output

Output t answers to the test cases:

  * if a positive integer number with the sum of digits equal to x and all digits are different exists, print the smallest such number; 
  * otherwise print -1. 

Example

Input


4
1
5
15
50


Output


1
5
69
-1

Solution (in CPP):

Solution:
#include <iostream>
using namespace std;

int main() {
	   int t;
    cin>>t;
    int g=19;
    int a=189;
    int b=1789,c=16789,d=156789,e=1456789,f=13456789;
    while(t--)
    {
        int n;
        cin>>n;
        if(n>45)
        cout<<-1<<endl;
        else if(n<10)
        cout<<n<<endl;
        else if(n>=10&&n<=17)
        cout<<(n-10)*10+g<<endl;
        else if(n>17&&n<25)
        cout<<(n-18)*100+a<<endl;
        else if(n>=25&&n<31)
        cout<<(n-25)*1000+b<<endl;
        else if(n>=31&&n<=35)
        cout<<(n-31)*10000+c<<endl;
        else if(n>=36&&n<=39)
        cout<<(n-36)*100000+d<<endl;
        else if(n>=40&&n<=42)
        cout<<(n-40)*1000000+e<<endl;
        else if(n>=43&&n<=44)
        cout<<(n-43)*10000000+f<<endl;
        else
        cout<<123456789<<endl;
        
    }
}