#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int T = 1;
cin >> T;
while(T--)
{
int n,l,r;
cin >> n >> l >> r;
vector<int> a(n);
for(auto& i:a) cin >> i;
sort(a.begin(),a.end());
ll ans = 0;
for(int i=0;i<n;i++)
{
int idx = lower_bound(a.begin()+i+1,a.end(),l-a[i])-a.begin();
int idx2 = upper_bound(a.begin()+i+1,a.end(),r-a[i])-a.begin();
cout<<idx<<" "<<idx2<<"\n";
//<<idx<<" "<<idx2<<"\n";
ans += idx2-idx;
}
cout << ans << "\n";
}
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBsbCBsb25nIGxvbmcKaW50IG1haW4oKQp7Cglpb3M6OnN5bmNfd2l0aF9zdGRpbygwKTsKCWNpbi50aWUoMCk7CglpbnQgVCA9IDE7CgljaW4gPj4gVDsKCXdoaWxlKFQtLSkKCXsKCQlpbnQgbixsLHI7CgkJY2luID4+IG4gPj4gbCA+PiByOwoJCXZlY3RvcjxpbnQ+IGEobik7CgkJZm9yKGF1dG8mIGk6YSkgY2luID4+IGk7CgkJc29ydChhLmJlZ2luKCksYS5lbmQoKSk7CgkJbGwgYW5zID0gMDsKCQlmb3IoaW50IGk9MDtpPG47aSsrKQoJCXsKCQkJaW50IGlkeCA9IGxvd2VyX2JvdW5kKGEuYmVnaW4oKStpKzEsYS5lbmQoKSxsLWFbaV0pLWEuYmVnaW4oKTsKCQkJaW50IGlkeDIgPSB1cHBlcl9ib3VuZChhLmJlZ2luKCkraSsxLGEuZW5kKCksci1hW2ldKS1hLmJlZ2luKCk7CgkJCWNvdXQ8PGlkeDw8IiAgIjw8aWR4Mjw8IlxuIjsKCQkJLy88PGlkeDw8IiAgIjw8aWR4Mjw8IlxuIjsKCQkJYW5zICs9IGlkeDItaWR4OwoJCSB9IAoJCWNvdXQgPDwgYW5zIDw8ICJcbiI7Cgl9Cn0=