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 JAVA):

Solution:
import java.util.*;
public class Ex{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t-->0){
            int x=sc.nextInt();
            if(x>=1 && x<=9){
                System.out.println(x);
            }
           else if(x>=10 && x<=17){
                int rem=x%10;
                rem+=1;
                System.out.println(rem+"9");
            }
            else if(x==18){
               System.out.println(189);        
            }
            else if(x==19){
               System.out.println(289);        
            }
            else if(x==20){
               System.out.println(389);        
            }
            else if(x==21){
               System.out.println(489);        
            }else if(x==22){
               System.out.println(589);        
            }else if(x==23){
               System.out.println(689);        
            }else if(x==24){
               System.out.println(789);        
            }
            else if(x==25){
               System.out.println(1789);        
            }
            else if(x==26){
               System.out.println(2789);        
            }
            else if(x==27){
               System.out.println(3789);        
            }
            else if(x==28){
               System.out.println(4789);        
            }
            else if(x==29){
               System.out.println(5789);        
            }
            else if(x==30){
               System.out.println(6789);        
            }
            else if(x==31){
                System.out.println(16789);
            }
            else if(x==32){
               System.out.println(26789);        
            }
            else if(x==33){
               System.out.println(36789);        
            }
            else if(x==34){
               System.out.println(46789);        
            }
            else if(x==35){
               System.out.println(56789);        
            }
            else if(x==36){
               System.out.println(156789);        
            }
            else if(x==37){
               System.out.println(256789);        
            }
            else if(x==38){
               System.out.println(356789);        
            }
            else if(x==39){
               System.out.println(456789);        
            }
            else if(x==40){
               System.out.println(1456789);        
            }
            else if(x==41){
               System.out.println(2456789);        
            }else if(x==42){
               System.out.println(3456789);        
            }
            else if(x==43){
               System.out.println(13456789);        
            }
            else if(x==44){
               System.out.println(23456789);        
            }
            else if(x==45){
               System.out.println(123456789);        
            }
            else{
                System.out.println(-1);
            }
        }    
    }
}