#include<algorithm>
#include<iostream>
#include<string>

const std::string bstop = "0123456789543210";

int main()
{
	int n;
	std::cin >> n;
	while( n-- )
	{
		int s, e;
		std::cin >> s >> e;
		
		bool fl = false;
		std::string ans;
		for( int i = 0; i != bstop.size(); ++i )
		{
			if( fl )
			{
				ans += ' ';
				ans += bstop[i];
			}

			if( bstop[i] == s + '0' )
			{
				ans.clear();
				fl = true;
				ans = bstop[i];
			}

			if( fl && bstop[i] == e + '0' )
				break;
		}
		
		std::cout << ans << std::endl;
	}

	return 0;
}