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:
//
// Created by Nguyen Hoang Vu on 12/9/2020.
//

#include<bits/stdc++.h>
using namespace std;
// disjoint set
#define MAX (int)1e5+10
int flag ;
int ans = INT_MAX;
int vis[10];
int n;
void test(int cur_sum, int j, int cur_ans){
    if(n - cur_sum < 10 && vis[n-cur_sum] == 0){
        ans = min(ans, cur_ans * 10 + n - cur_sum);
        return;
    }
    for(int i = j + 1; i < 10; i++){
        vis[i] = 1;
        test(cur_sum + i, i, cur_ans * 10 + i);
        vis[i] = 0;
    }
}
void solve(){
    cin >> n;
    ans = INT_MAX;
    memset(vis, 0, sizeof(vis));
    if(n < 10){
        cout << n <<endl;
        return;
    }
    flag = true;
    test(0, 0, 0);
    if(ans == INT_MAX) cout << -1 << endl;
    else{
        cout << ans << endl;
    }

}
int main() {
    ios::sync_with_stdio(false);
    cin.tie();
    int t;
    cin >> t;
    while(t--){
        solve();
    }
}