#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i,j;
  int n;
  vector<int> r,f;
  cin>>n;
  r.reserve(n);
  f.reserve(n);
  for(i=0;i<n;i++)
    cin>>r[i]>>f[i];
  for(i=0;i<n;i++){
    if(r[i]<6){
      if(f[i]<r[i]){
	for(j=r[i];j>f[i];j--)
	  cout<<j<<" ";
	cout<<j<<endl;
      }else{
	for(j=r[i];j<f[i];j++)
	  cout<<j<<" ";
	cout<<j<<endl;
      }
    }else{
      if(f[i]>r[i]){
	for(j=r[i];j<f[i];j++)
	  cout<<j<<" ";
	cout<<j<<endl;
      }else{
	for(j=r[i];j<10;j++)
	  cout<<j<<" ";
	if(f[i]>5){
	  cout<<"5 4 3 2 1 0 1 2 3 4 5 ";
	  for(j=6;j<f[i];j++)
	    cout<<j<<" ";
	  cout<<j<<endl;
	}else{
	  for(j=5;j>f[i];j--)
	    cout<<j<<" ";
	  cout<<j<<endl;
	}
      }
    }
  }
  return 0;
}