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.*;
import java.lang.*;
import java.io.*;


public class Solution
{
	public static void main (String[] args) throws java.lang.Exception
	{
		
		BufferedReader br1=new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));
		int t=Integer.parseInt(br1.readLine());
		int l=0;
		while(t>l)
		{
		    l=l+1;
		    //int n=Integer.parseInt(br1.readLine());
		    int num=Integer.parseInt(br1.readLine());
		    if(num<=9)
		    {
		        System.out.println(num);
		    }
		    else if(num>45)
		    {
		        System.out.println("-1");
		    }
		    else
		    {
		        String s=new String("");
		        int num1=9;
		        while((num>0)&&(num1>0))
		        {
		            s=s+num1;
		            num=num-num1;
		            if((num<9)&&(num<num1))
		            {
		                s=s+num;
		                break;
		            }
		            num1=num1-1;
		        }
		        String ans=new String("");
		        for(int i=s.length()-1;i>=0;i--)
		        {
		            ans=ans+s.charAt(i);
		        }
		        System.out.println(ans);
		    }
		    
		}
	}
}