#include <cstdio>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
int ls = 15;
int l[] = {0,1,2,3,4,5,6,7,8,9,5,4,3,2,1};
int main(void){
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    int a,b;
    cin >> a >> b;
    if(0 < a && a <= 5 && a > b){
      a = ls - a;
    }

    for(int j = a; l[j%ls] != b; j++){
      cout << l[j%ls] << ' ';
    }
    cout << b << endl;
  }
}