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 Temp
{
    static void print(Object o) throws IOException {
        OutputStream out = new BufferedOutputStream(System.out);

        out.write((o+" ").getBytes());

        out.flush();
    }

    static void println(Object o) throws IOException {
        OutputStream out = new BufferedOutputStream(System.out);

        out.write((o+"\n").getBytes());

        out.flush();
    }

    public static void main(String[] args) throws IOException {
        Scanner fr = new Scanner(System.in);

        OutputStream out = new BufferedOutputStream(System.out);

        int t = fr.nextInt();

        while (t -- > 0)
        {
            long n = fr.nextLong();

            if (n>45){
                out.write((-1 + " ").getBytes());
            }
            else{
                List<Integer> list = new ArrayList<>();
                if (n - 9 >= 0) {
                    n -= 9;
                    list.add(9);
                }

                if (n != 0) {
                    if (n - 8 >= 0) {
                        n -= 8;
                        list.add(8);
                    }

                    if (n != 0) {
                        if (n - 7 >= 0) {
                            n -= 7;
                            list.add(7);
                        }

                        if (n != 0) {
                            if (n - 6 >= 0) {
                                n -= 6;
                                list.add(6);
                            }

                            if (n != 0) {
                                if (n - 5 >= 0) {
                                    n -= 5;
                                    list.add(5);
                                }

                                if (n != 0) {
                                    if (n - 4 >= 0) {
                                        n -= 4;
                                        list.add(4);
                                    }

                                    if (n != 0) {
                                        if (n - 3 >= 0) {
                                            n -= 3;
                                            list.add(3);
                                        }

                                        if (n != 0) {
                                            if (n - 2 >= 0) {
                                                n -= 2;
                                                list.add(2);
                                            }

                                            if (n != 0) {
                                                if (n - 1 >= 0) {
                                                    n -= 1;
                                                    list.add(1);
                                                }

                                                if (n != 0) {
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                Collections.sort(list);

                for (int ele : list) if (n==0) out.write((ele + "").getBytes());

            }
            out.write(("\n").getBytes());
        }

        out.flush();
        out.close();
    }
}