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 <bits/stdc++.h>

#define debug_input freopen("stdin.in", "r", stdin)
#define debug_output freopen("stdout.out", "w", stdout)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORALL(i, n) for(int i = 0; i < n; i++)
#define FORD(i, a, b) for(int i = a; i >= b; i--)
#define SORT(a) sort(a.begin(), a.end())
#define REV(a) reverse(a.begin(), a.end())
#define NP(a) next_permutation(a.begin(), a.end())
#define ALL(a) a.begin, a.end()
#define mp make_pair
#define pb push_back
#define endl '\n'
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 1e5;
const int mod = 1e9 + 7;
const ll inf = 1e18;
const double pi = 3.141592653589793;
const int dr[4] = {-1,0,1,0}, dc[4] = {0,1,0,-1};

void solve() {
	int temp = 0;
	int x; cin >> x;
	temp = x;
	int now = 9;
	vector<int> ans;

	while(x && now) {
		if(x >= now) {
			x -= now;
			ans.push_back(now);
		}
		now--;
	}

	int sum = 0;
	for(auto it: ans) {
		sum += it;
	}
	if(sum == temp) {
		SORT(ans);
		for(auto it: ans) {
			cout << it;
		}
		cout << endl;
	}
	else {
		cout << -1 << endl;
	}
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);

	int t = 1; 
	cin >> t;
	while(t--) {
		solve();
	} 
	return 0;
}