# Read input from stdin and provide input before running code
import sys
T = int(raw_input().strip())
while T>0:
    N, K = raw_input().strip().split()
    N = int(N)
    K = int(K)
    if K > 81:
        print -1
    else:
        R=K%9
        if R == 0:
            A = K//9
            R = 9
        else:
            A = K//9+1
        if R <= A:
            B=R-1
        else:
            B = R
        for i in xrange(0,N):
            if i%2 == 0:
                sys.stdout.write(str(A))
            else:
                sys.stdout.write(str(B))
        print ""        
    T = T-1