#include <iostream>
using namespace std;

int busLine[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 4, 3, 2, 1 };
const int SIZE = sizeof(busLine) / sizeof(int);

int main()
{
	int n;
	while( cin >> n ){
		for( int i = 0; i < n; ++i ){
			int start, end;
			cin >> start >> end;

			int step = 0;
			int index = 0;
			int memo[ 10 ];
			bool bFoundStart = false;
			while( 1 ){
				if( busLine[ index ] == start ){
					bFoundStart = true;
					step = 0;
					memo[ step ] = busLine[ index ];
					++index;
					continue;
				}
				++step;
				memo[ step ] = busLine[ index ];
				if( bFoundStart && busLine[ index ] == end ){
					break;
				}
				++index;
				index %= SIZE;
			}

			bool bFirst = true;
			for( int j = 0; j <= step; ++j ){
				if( bFirst ){
					bFirst = false;
				}else{
					cout << " ";
				}
				cout << memo[ j ];
			}
			cout << endl;
		}
	}
	return 0;
}