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 CPP):

Solution:
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;

int digits_add_to(int x) {
    if (x < 10) return x;
    if (x > 45) return -1;
    int ans = 9; int digit_sum = 9;
    for (int zero=1;zero<=8;zero++) {
        for (int base=1; base<10-zero; base ++) {
            digit_sum ++;
            ans += pow(10,zero);
            if (x == digit_sum) {
                return ans;
            }
        }
    }
    return ans;
}
int main() {
    int n; cin >> n; int x;
    vector<int> result;
    result.reserve(n);
    for (int loop=0;loop<n;loop++) {
        cin >> x;
        result.push_back(digits_add_to(x));
    }
    for (int res : result) cout << res << endl;
}