#include<iostream>
using namespace std;
int main(){
	int s,t,n; cin>>n;
	while(n--){
		cin>>s>>t;
		if(s<t){
			while(s!=t)cout<<s++<<" ";
			cout<<t<<endl;
		}else{
			if(0<=t&&t<=5){
				while(s!=t){
					cout<<s<<" ";
					s=s>5?s>8?5:s+1:s-1;
				}
				cout<<t<<endl;
			}else{
				while(s!=t){
					cout<<s++<<" ";
					if(s==10){
						s=6;
						cout<<"5 4 3 2 1 0 1 2 3 4 5 ";
					}
				}
				cout<<t<<endl;
			}
		}
	}
	return 0;
}