#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#define INF 1000000
using namespace std;
int loop[15] ={0,1,2,3,4,5,6,7,8,9,5,4,3,2,1};
	
int main(){
  int a,b;
  int mn = INF;
  vector<int>ans;
  int n;
  cin >> n;
  while(n-- ){
    cin >> a >>b;
    ans.clear();
    ans.push_back(a);
    for(int i = a+1 ;; i++){

      if(loop[i%15] == a)ans.clear();

      ans.push_back(loop[i%15]);

      if(loop[i%15] == b)break;
    }

    for(int i = 0 ; i < ans.size() ; i++ ){
      if(i == 0)cout << ans[i];
      else cout << ' ' << ans[i];  
    }
    cout << endl;
  }
  return 0;
}