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

Solution:
import sys
def get_list():return list(map(int, sys.stdin.readline().split()))
def get_string():return input()
def get_int():return int(input())
def get_ints(): return map(int, sys.stdin.readline().split())
def solve(k):
  k=str(k)
  k1=set(k)
  summ=0
  if len(k)==len(k1):
    return True
  return False
def re():
   dp=[0]*52
   for i in range(10**5+1,0,-1):
     if solve(i):
       summ=0
       
       for j in str(i):
        summ+=int(j)
       if summ<=50:
        dp[summ]=i
   return dp
dp=re()
dp[36]=156789
dp[37]=256789
dp[38]=356789
dp[39]=456789
dp[40]=1456789
dp[41]=2456789
dp[42]=3456789
dp[43]=13456789
dp[44]=23456789
dp[45]=123456789
#for i in range(53):print(dp[i],i)
for _ in range(get_int()):
   n=int(input())
   if dp[n]!=0:print(dp[n])
   else:print(-1)