#include <iostream>
using namespace std;

int main() {
	int hmData;		//	how many Data?
	cin >> hmData;
	
	for(int i = 0;i < hmData;i++)
	{
		int Dep,Dest;	//Dep = Departure Place,Dest = Destination Place
		cin >> Dep;
		cin >> Dest;
		
		if(Dep <= 5 && Dest <= 5)
		{
			if(Dep > Dest)
			{
				Dep = 15 - Dep;
				Dest = 15 - Dest;
			}
		}else{
			if(Dep > Dest)
			{
				Dest = 15 - Dest;
			}
		}
		
		while(Dep <= Dest)
		{
			if(Dep > 9){
				cout << 15 - Dep;
			}else{
				cout << Dep;
			}
			cout << " ";
			Dep++;
		}
		cout << "\n";
	}
	return 0;
}