#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

int main(){
	int s[15] = {0,1,2,3,4,5,6,7,8,9,5,4,3,2,1};
	int N;
	cin>>N;
	for(int ds=0;ds<N;ds++){
		int A,B;
		cin>>A>>B;
		vector<int> ans;
		int ss = find(s,s+15,A)-s, d = 0;
		for(int i=0;i<15;i++, d++){
			if(s[(ss+i)%15]==A){
				d = 0; ans.clear();
			}
			ans.push_back(s[(ss+i)%15]);
			if(s[(ss+i)%15]==B) break;
		}
		printf("%d",ans[0]); for(int i=1;i<ans.size();i++) printf(" %d",ans[i]); puts("");
	}
	return 0;
}