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.Scanner;

public class UniqueNumber1462C {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int noOfInput = sc.nextInt();
		for(int i =0;i<noOfInput;i++){
			int input = sc.nextInt();
			System.out.println(getSmallestAnswer(input));
		}

	}
	private static int getSmallestAnswer(int input){
		if(input > 0 && input<10){
			return input;
		} else if(input > 45){
			return -1;
		}
		String number = "9";
		while(getSum(number)<input){
			number = (Integer.valueOf(String.valueOf(number.charAt(0))) - 1) + number;
		}
		
		while(getSum(number)>input){
			number = (Integer.valueOf(String.valueOf(number.charAt(0))) - 1) + number.substring(1,number.length());
		}
		return Integer.valueOf(number);	
	}

	private static int getSum(String num){
		int sum =0;
		for(int i=0;i<num.length();i++){
			sum += Integer.valueOf(String.valueOf((num.charAt(i))));
		}
		return sum;
	}
}