T = int(input())

for t in xrange(T):
    n, k = map(int, raw_input().split())
    
    found = False
    count = 1
    i = 1
    while(not found):
        for j in xrange(0, 10):
            if(i != j):
                if(n % 2 == 0):
                    num = (str(i) + str(j)) * (n/2)
                else:
                    num = (str(i) + str(j)) * ((n - 1)/2) + str(i)
                 
                    
                if(count == k and len(num) == n):
                    print num
                    found = True
                    break
                elif(count > k or len(num) > n):
                    print -1 
                    found = True
                    break               
                
                count += 1  
            
        i += 1