for i in xrange(input()):
	a,b=[int(i) for i in raw_input().split()]
	if b>81:print -1
	else:
		b,c=b/9,b%9
		b=range(11)[b+1]
		if c<=b:c=c-1
		else:c=c
		if c==-1:b,c=b-1,9
		if c==9 and b==9:c=8
		b,c=str(b),str(c)
		s=(b+c)*(a/2)
		if a%2!=0:print s+b
		else:print s