#include <iostream>
using namespace std;

int main() {
  int a[15] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 4, 3, 2, 1};
  int n, s, e, p;

  cin >> n;
  for (int i=0; i<n; i++) {
    cin >> s >> e;
    if (!s || s > 5 || s < e) {
      p = s;
    } else {
      p = 15-s;
    }
    while (a[p]!=e) {
      cout << a[p] << " ";
      p = (p+1)%15;
    }
    cout << a[p] << endl;
  }
  return 0;
}