series = map(lambda x: x%10 , range(100))
for i in [1,11,21,31,41,51,61,71,81]:
	del series[i]

def solve(n, k):
	#return condition
	if k > 81:
		return "-1"
	else :	
		if k%9 == 0:
			a = k//9
		else:
			a = k//9 + 1
			
		#finding b
		b = series[k-1]
		s = []
		for i in range(n):
			
			if i%2 == 0:
				s.append(str(a))
			else:
				s.append(str(b))
				
		return "".join(s)
	
tcs = int(raw_input())
for i in range(tcs):
	n,k= raw_input().split(" ")
	print solve(int(n),int(k))