#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

int main() {
	int n,s,e,r[15]={0,1,2,3,4,5,6,7,8,9,5,4,3,2,1};
	cin >> n;
	for (;n>0;n--) {
     cin >> s >> e;
	 if (s>e && s<6) s=15-s;
	 while(true) { 
		 cout << r[s];
		 if (r[s]==e) {cout << endl; break;}
		 cout << ' ';
		 s=(s+1) % 15;
	 }
	}
	return 0;
}