#The solution in Python3 is as follows:
import math
for _ in range(int(input())):
n,k=list(map(int,input().split()))
odd=math.ceil(k/9)
even=k%9
if even<=odd:
if even!=0:
even-=1
else:
even=9
if k==81:
even-=1
if k>81:
print(-1)
else:
l=[]
for i in range(n):
if i%2==0:
l.append(str(odd))
else:
l.append(str(even))
print("".join(l))
#Keep visiting for more solutions of HackerRank problems in Python 3.Thank you!!!