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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class C {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int T = fs.nextInt();
        for(int tt=0; tt<T; ++tt) {
            int x = fs.nextInt();
            int dbCheck[] = new int[10];
            ArrayList<Integer> ret = new ArrayList<>();
            int curDigit = 9;
            while(true) {
                if(x < curDigit) break;
                if(curDigit == 0) break;

                x -= curDigit;
                dbCheck[curDigit]++;
                ret.add(curDigit);
                curDigit--;
            }
            if(x > 0) {
                ret.add(x);
                dbCheck[x]++;
                if (dbCheck[x] >= 2) {
                    System.out.println(-1);
                    continue;
                }
            }
            Collections.reverse(ret);
            for(int r : ret) System.out.print(r);
            System.out.println();
        }
    }
    public static int digitSum(int num) {
        int sum = 0;
        int[] doubleCheck = new int[10];
        while(num != 0) {
            sum += (num%10);
            doubleCheck[num%10]++;
            if(doubleCheck[num%10] >= 2) return -1;
            num /= 10;
        }
        return sum;
    }


    static final Random random=new Random();

    static void ruffleSort(int[] a) {
        int n=a.length;//shuffle, then sort
        for (int i=0; i<n; i++) {
            int oi=random.nextInt(n), temp=a[oi];
            a[oi]=a[i]; a[i]=temp;
        }
        Arrays.sort(a);
    }

    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }


}