import math
import sys

T = int(raw_input())
while (T > 0):
	T-=1
	str = raw_input()
	num = []
	for s in str.split():
		num.append(int(s))
	N = num[0]
	K = num[1]
	if K > 81:
		print -1
	else:
		a = int(math.ceil(float(K)/9))
		b = int(K%9) - 1
		if b == -1:
			if a == 9:
				b = 8
			else:
				b = 9
		elif b > a:
			b +=1
		elif b == a:
			b += 1
		for x in range(0,N):
			if x%2==0:
				print a,
				sys.stdout.write('')
			else:
				print b,
				sys.stdout.write('')
		print