#include<bits/stdc++.h>
using namespace std;

int main() {
  int n;
  int bus_stop[]={0,1,2,3,4,5,6,7,8,9,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9};
  cin>> n;
  while(n--) {
    int get, off;
    cin>> get>> off;
    int i;
    for((get<6 && get>off) ? i=(15-get):i=get; bus_stop[i]!=off; i++) {
      cout<< bus_stop[i]<< ' ';
    }
    cout<< off<< endl;
  }
}