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>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pii;
#define ffor(i,n) for(ll i=0;i<n;i++)
#define rfor(x,y) for(ll i=x;i<y;i++)
#define ff first
#define ss second
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(v) v.begin(),v.end()
#define vi std::vector<ll>
void solve()
{		
	
	ll n;
	cin>>n;
	if(n<=9)
	{
		cout<<n<<endl;
		return;
	}
	map<ll,ll> m;
	ffor(i,10)
	{
		if(i==0)
			continue;
		m[i]=0;
	}
	for(int i=9;i>0;i--)
	{	
		if(n>i)
		{
			n-=i;
			m[i]++;
		}
		else
		break;
	}
	if(m[n]==0)
	{
		m[n]++;
		for(int i=1;i<=9;i++)
		{
			if(m[i]==1)
			{
				cout<<i;
			}
		}
		cout<<endl;
	}
	else
	{
		cout<<-1<<endl;
	}



}
int main()
{   
    #ifndef ONLINE_JUDGE
    freopen("input.in","r",stdin);
    freopen("output.in","w",stdout);
    #endif
    fastio
    ll t=1;
    cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}