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

public class Solution {

    private static FastReader in = new FastReader();

    public static void main(String[] args) throws Exception {
        int t = in.nextInt();
        while (t-- > 0) {
            solve();
        }
    }

    static void solve() {
        
        int x = in.nextInt();
        if(x > 45){
            System.out.println(-1);
            return;
        }
        if(x < 10){
            System.out.println(x);
            return;
        }
        if(x>9 && x < 18){
            int ans = (x-9)*10+9;
            System.out.println(ans);
            return;
        }
        if(x == 18){
            System.out.println(189);
            return;
        }
        if(x > 18 && x <25){
            int ans = (x-17)*100+89;
            System.out.println(ans);
            return;
        }

        if(x == 25){
            System.out.println(1789);
            return;
        }

        if(x>25 && x<31){
            int ans = (x - 24)*1000 + 789;
            System.out.println(ans);
            return;
        }

        if(x == 31){
            System.out.println(16789);
            return;
        }
        if(x>31 && x<36){
            int ans = (x-30)*10000+6789;
            System.out.println(ans);
            return;
        }
        if(x == 36){
            System.out.println(156789);
            return;
        }
        if(x>36 && x<40){
            int ans = (x-35)*100000+56789;
            System.out.println(ans);
            return;
        }
        if(x==40){
            System.out.println(1456789);
            return;
        }
        if(x==41){
            System.out.println(2456789);
            return;
        }
        if(x==42){
            System.out.println(3456789);
            return;
        }
        if(x==43){
            System.out.println(13456789);
            return;
        }
        if(x==44){
            System.out.println(23456789);
            return;
        }
        if(x==45){
            System.out.println(123456789);
            return;
        }

    }
}


class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}