# Read input from stdin and provide input before running code

second = []
invalid = [1,11,21,31,41,51,61,71,81]
for i in range(100):
    second.append(i % 10)
for i in invalid:
    del second[i]
    
    

for _ in range(input()):
    
    n, k = map(int, raw_input().split())
    if k > 81:
        print "-1"
        continue
    if k % 9 == 0:
        start = k // 9
    else:
        start = k // 9 + 1
    nexts = second[k - 1]
    ans = ""
    for i in range(n):
        if i%2 == 0:
            ans += str(start)
        else:
            ans += str(nexts)
   
    print ans