t=input()
while t > 0:
	a=map(int,raw_input().split())
	n=a[0]
	k=a[1]
	if k > 81:
		print -1
	else:
		mo=k%9
		di=k/9
		if mo == 0:
			if di == 9:
				mo=8
			else:
				mo=9
			di-=1
		elif mo <= (di+1) :
			mo-=1
		flag=1
		s=''
		for i in xrange(n):
			if flag:
				s=s+str(di+1)
			else:
				s=s+str(mo)
			flag=1-flag 
		print s
	t-=1