#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:36777216")
#pragma pack(1)
using namespace std;
long long mod = 998244353;
long long inf = 1e9;
long double eps = 1e-6;
double pi = acosl(-1);
ifstream in("input.txt");
ofstream out("output.txt");
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    long long n;
    scanf("%lld", &n);
    vector<int> a(n);
    for (int i = 1; i <= n; i++) {
      a[i - 1] = i;
    }
    sort(a.begin(), a.end(), [](const int& a, const int& b) {
      return to_string(a) < to_string(b);
    });
    long long l, r;
    scanf("%lld%lld", &l, &r);
    int len = r - l + 1;
    int kk = 0;
    l--;
    r--;
    kk = (r == n * (n - 1));
    r -= kk;
    int len1 = r - l;
    long long start = 0;
    for (; start < n; start++) {
      if (2 * (n - 1 - start) < l) {
        l -= 2 * (n - 1 - start);
        r -= 2 * (n - 1 - start);
      } else {
        break;
      }
    }
    vector<int> ans;
    int offset = l / 2 + 1;
    for (int i = 0; i <= len1; i++) {
      if ((l + i) % 2 == 1) {
        ans.push_back(a[start + offset]);
        offset++;
        if (offset + start == n) {
          start++;
          offset = 1;
        }
      } else
        ans.push_back(a[start]);
    }
    if (kk == 1) {
      ans.push_back(a[0]);
    }
    for (auto v : ans) {
      printf("%d ", v);
    }
    printf("\n");
  }
  return 0;
}
