// 2011/03/22 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int bus[15];
	bus[0]  = 0;
	bus[1]  = 1;
	bus[2]  = 2;
	bus[3]  = 3;
	bus[4]  = 4;
	bus[5]  = 5;
	bus[6]  = 6;
	bus[7]  = 7;
	bus[8]  = 8;
	bus[9]  = 9;
	bus[10] = 5;
	bus[11] = 4;
	bus[12] = 3;
	bus[13] = 2;
	bus[14] = 1;

	int n;
	cin >> n;

	for(int i=0; i<n; i++){
		int a, b;
		cin >> a >> b;

		if(a==1&&b<1)
			a = 14;
		if(a==2&&b<2)
			a = 13;
		if(a==3&&b<3)
			a = 12;
		if(a==4&&b<4)
			a = 11;
		if(a==5&&b<5)
			a = 10;

		cout << bus[a];
		do{
			a = (a+1)%15;
			cout << ' ' << bus[a];
		}while(bus[a]!=b);
		cout << endl;
	}

	return 0;
}