'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
tc = int(raw_input())
if tc>=1 and tc<=100:
	array = [ ]
	for i in range(0,tc,1):
		nkstr = raw_input()
		ar = nkstr.split()
		n = int(ar[0])
		k = int(ar[1])
		if (n>=3 and n<=1000) and (k>=1 and k<=100):
			arr = [0,1,2,3,4,5,6,7,8,9]
			if k>81:
				array.append('-1')
			elif k<=81:
				r = k%9
				d = k/9
				while len(str(d))!=1:
					d = d/9
				if r!=0:
					d = d+1
				if r==0 and d!=r and d!=9:
					p = 9
				elif r==0 and d==9:
					p = 8
				elif d==r and r>1:
					p = r-1
				elif r==1:
					p = 0
				elif d>r and r>1:
					p = r-1
				elif d<r and r>1:
					p = r
				st = str(d)
				for l in range(0,n-1,1):
					if l%2==0:
						st = st + str(p)
					else:
						st = st + str(d)
				array.append(st)
	for m in array:
		print m
else:
	print "Constraint Violation"