#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
template <class _Tv> inline string join(const _Tv &v,string sep=" "){
    ostringstream s;for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())s<<sep;s<<*it;};return s.str();
}

int tbl[] = { 0,1,2,3,4,5,6,7,8,9,5,4,3,2,1 };

vector<int> solve(int st, int ed){
    vector<int> r;
    int n = sizeof(tbl)/sizeof(tbl[0]);
    for(int i = 0; i < n*2; ++i){
        if(tbl[i%n] == st) r.clear();
        r.push_back(tbl[i%n]);
        if(tbl[i%n] == ed) break;
    }
    return r;
}

int main(){
    int n,a,b;
    cin >> n;
    while(cin >> a >> b){
        cout << join(solve(a,b)) << endl;
    }
    return 0;
}