t=input()
for tc in xrange(t):
	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)
		di-=(x==0)
		s=''
		for i in xrange(n):
			if i%2:
				s=s+str(mo)
			else:
				s=s+str(di+1)
		print s