tc = int(raw_input())
for i in range(tc):
	yo = 0
	el = []
	s = raw_input()
	n,k = map(int, s.split())
	if k > 81:
		print -1
		continue
	else:
		if k%9 != 0:
			x = int(k/9) + 1
		else:
			x = int(k/9)
		y = k%9
		if y == 0:
			z = 9
		else:
			z = y - 1
			if ((x * 10) + x) <= ((x * 10) + z):
				z = z + 1
		if x == z:
			z = z - 1
		x = str(x)
		z = str(z)
		while yo < n:
			el.append(x)
			yo = yo + 1
			el.append(z)
			yo = yo + 1
		el = el[:n]
		el = "".join(el)
		print el