def roy_and_wobbly_numbers():
	t = input()
	b_map = []
	for i in xrange(100):
		b_map.append(i%10)
	for i in [1,11,21,31,41,51,61,71,81]:
		del b_map[i]
	for tt in xrange(t):
		n,k = map(int,raw_input().split())
		if k > 81:
			print "-1"
		else:
			# finding 'a'
			if k%9 == 0:
				a = k//9
			else:
				a = k//9 + 1
			#lookup 'b' in b_map
			b = b_map[k-1]
			#create a string of length N
			s = []
			for i in range(n):
				if i%2 == 0:
					s.append(str(a))
				else:
					s.append(str(b))
			print ''.join(s)
roy_and_wobbly_numbers()