import math as m
selectlist = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
for _ in range(input()):
	N, k = map(int, raw_input().split())
	if k > 81:
		print -1
		continue
	mynum = k/9 + 1
	varnum = None
	modval = k % 9
	if (mynum - 1) > 0 and modval == 0:
		mynum = k/9
		modval = 9	
	count = 1
	for val in selectlist:
		if count == modval:
			varnum = val
		if val != mynum:
			count += 1
	numlist = [str(mynum), str(varnum)]
	finalnum = ''
	for index in range(N):
		finalnum += numlist[index % 2]
	print int(finalnum)