import math

t = raw_input()
T = list()

for i in range(int(t)):
	inp = (raw_input()).split()
	N = int(inp[0])
	K = int(inp[1])

	if K <= 81:
		a = int(math.ceil(float(K) / 9))
		b = K % 9

		if b == 0:
			b = 9
		
		if (a >= b):
			key = b - 1
		elif a < b:
			key = b

		str_num = ""
		for k in range(N):
			if(k % 2 == 0):
				str_num = str_num + str(a)
			else:
				str_num = str_num + str(key)

		T.append(str_num)
	else:
		T.append("-1")

for x in T:
	print x