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

Solution:
n = int(raw_input())
def getSum(n): 
    sum = 0
    for digit in str(n):  
      sum += int(digit)       
    return sum
    
def concat(x,y):
  return int(str(x)+str(y))

lst=8
ptr = 0
ptrs = [0]
ar = [0,1,2,3,4,5,6,7,8,9]
result=[]

for x in xrange(50):
  if len(ptrs) <= 9:
    number = 0
    for y in xrange(ptr+1):
      number=concat(number,ar[ptrs[ptr-y]])
    result.append(number)
    
    if (ptr == 0 and ptrs[ptr] < 9) or ptrs[ptr] < ptrs[ptr-1]-1:
      ptrs[ptr]+=1
    else:
      ptr+=1
      ptrs.append(1)
  else:
    result.append(-1)
    
  
for i in xrange(n):
  number = int(raw_input())
  if number <1 or number >= 50:
    print -1
  else:
    print result[number]