def wobbly(j,k):
	a,b=1,0
	for i in range(1,k):
		if(b!=9):
			b=b+1
		else:
			a=a+1
			b=0
		if(a==b):
			b=b+1
	a=str(a)
	b=str(b)
	strin = ""
	while(j>1):
		strin=strin+a+b
		j=j-2
	if(j==1):
		strin=strin+a
	print(strin)

n =int(input())
while(n>0):
	j,k=raw_input().split()
	j=int(j)
	k=int(k)
	if(k>81):
		print "-1"
	else:
		wobbly(j,k)
	n=n-1;