#include<stdio.h>
#include<stdlib.h>
#include<math.h>
struct In
{
int abc;
int cba;
};
struct In str1[55];
int cmp(const void *a,const void *b)
{
return (*(In *)a).cba > (*(In *)b).cba? 1 : -1;
}
int main()
{
int n,a,b,c,d,i,e;
scanf("%d",&n);
while(n--){
scanf("%d%d",&a,&b);
c=b-a;
for(i=0;i<=c;i++){
str1[i].abc=a;
a++;
}
for(i=0;i<=c;i++){
e=str1[i].abc;
str1[i].cba=e%10;
e=e/10;
while(e!=0){
str1[i].cba=str1[i].cba*10+e%10;
e=e/10;}
}
qsort(str1,c+1,sizeof(str1[0]),cmp);
printf("%d",str1[0].abc);
for(i=1;i<=c;i++)
printf(" %d",str1[i].abc);
printf("\n");
}
return 0;
}