for tc in xrange(input()):
	n,k=map(int,raw_input().split())
	if k > 81:
		print -1
	else:
		mo=k%9
		di=k/9
		x=mo
		if mo <= (di+1) :
			mo=(mo+9)%10-(di/9)
		s=''
		for i in xrange(n):
			s+=str(mo) if i%2 else str(di+(x!=0))
		print s