rw_num = [str(i) + str(j) for i in range(1,10) for j in range(10) if i != j]
n  = input()
for i in range(n):
    inp = raw_input().split()
    r = int(inp[0])
    k = int(inp[1])
    try:
        print (rw_num[k - 1] * (r/2 + 1))[:r]
    except:
        print -1