ignore = [1,11,21,31,41,51,61,71,81]
b = [i%10 for i in xrange(100)]
 
for i in ignore:
	del b[i]
		
def find(N,K):
	global b
	if K > 81:
		return -1
	if K%9==0:
		a = K//9
	else:
		a = K//9+1
	ans = ""
	for i in xrange(0,N):
		if i%2==0:
			ans += str(a)
		else:
			ans += str(b[K-1])
	return ans
 
 
T = int(raw_input())
while T > 0:
	T -= 1
	N,K = tuple(int(i) for i in raw_input().split(' '))
	print find(N,K)