#include<iostream>
using namespace std;
int main(){
	int a[16]={0,1,2,3,4,5,6,7,8,9,5,4,3,2,1,0};
        int n;
	cin>>n;
        int x,y;
        for(int i=0;i<n;i++){
		cin>>x>>y;
		int l,m;
             if(x<y){
                for(int j=0;j<10;j++)
                        if(a[j]==x) l=j;
	        for(int k=l;k<10;k++)
			if(a[k]==y) m=k;
		for(int p=l;p<=m;p++){
		    cout<<a[p]<<" ";
                }
              }else {
		for(int j=0;j<16;j++)
                        if(a[j]==x) l=j;
	        for(int k=l;k<16;k++)
			if(a[k]==y) m=k;
		for(int p=l;p<=m;p++){
		    cout<<a[p]<<" ";
                }
              }
              cout<<endl;
        }
        return 0;
}