import math

testcases = input()
#print testcases
lengtharray = [1]*testcases
#print lengtharray
ktharray = [1]*testcases

answerarray = [1]*testcases

for i in range(0, testcases):
    case = raw_input()
    numbers = case.split(' ')
    lengtharray[i] = int(numbers[0])
    ktharray[i] = int(numbers[1])
    
#print lengtharray
#print ktharray
a = 0
b = 0

for i in range (0,testcases):
    a = int(math.ceil(ktharray[i]/9.0))
    if a > 9:
        print -1
        continue
    tmp = ktharray[i]%9
    #print "tmp" + tmp
    if tmp <= a:
        b = tmp - 1
        if b < 0:
            if a == 9:
                b = 8
            else:
                b = 9
    else:
        b = tmp
    #print "now"
    stringtoprint = ""
    for j in range (0, lengtharray[i]):
        if j%2 == 0:
            stringtoprint = stringtoprint + str(a)
        else:
            stringtoprint = stringtoprint + str(b)
    print stringtoprint


#print 'ceil'
#print ktharray[0]
#print float(ktharray[0]/9)
#print int(math.ceil(ktharray[0]/9.0))