#include <iostream>
#include <vector>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
	int n;
	cin >> n;

	int d[16] = {0,1,2,3,4,5,6,7,8,9,5,4,3,2,1,0};

	rep(i,n)
	{
		int a,b;
		cin >> a >> b;

		vector<int> v,v2;
		
		bool flag = false;
		for(int j=0;j<16;j++)
		{
			if(d[j] == a && !flag)
			{
				flag = true;
			}
			else if(d[j] == a && flag)
			{
				v.clear();
			}

			if(flag) v.push_back(d[j]);
			
			if(flag && d[j] == b)
			{
				flag = false;
				break;
			}
		}

		rep(j,v.size())
		{
			cout << v[j]  << " ";
		}
		cout << endl;
	}
	return 0;
}