#include <bits/stdc++.h>
using namespace std;
const int N = 123;
const long long oo = 1e18 + 123;
int n;
vector<pair<long long, pair<int, int> > > res;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  int t;
  cin >> t;
  while (t--) {
    res.clear();
    long long l, r;
    cin >> n >> l >> r;
    long long m = (long long)n * (n - 1);
    if (l >= m + 1) {
      cout << 1 << "\n";
      continue;
    }
    long long f = 2 * (n - 1) - 1, cur = 0;
    int i = 1;
    while (f < l) {
      ++i;
      cur = f;
      if (i <= n)
        f += 2 * (n - i);
      else
        ++f;
    }
    while (cur < r && cur < m) {
      if (i < n) {
        if (i > 1) res.push_back(make_pair(++cur, make_pair(n, i)));
        for (int j = i + 1; j <= n; ++j) {
          res.push_back(make_pair(++cur, make_pair(i, j)));
          if (j < n) res.push_back(make_pair(++cur, make_pair(j, i)));
        }
        ++i;
      } else {
        res.push_back(make_pair(++cur, make_pair(n, 1)));
      }
    }
    int x = 0;
    for (pair<long long, pair<int, int> > ed : res) {
      if (r == l) {
        if (ed.first == l) cout << l << "\n";
      } else if (ed.first >= l && ed.first <= r - 1) {
        cout << ed.second.first << " ";
        if (ed.first >= r - 1) cout << ed.second.second << "\n";
      }
    }
  }
  return 0;
}
