#include <bits/stdc++.h>
using namespace std;
#define int              long long int
#define double           long double
inline int power(int a, int b) {
    int x = 1;
    while (b) {
        if (b & 1) x *= a;
        a *= a;
        b >>= 1;
    }
    return x;
}


const int M = 1000000007;
const int N = 3e5+9;
const int INF = 2e9+1;
const int LINF = 2000000000000000001;

//_ ***************************** START Below *******************************



vector<int> a;


int bruteforce(int n, int k1, int k2){
	int ans = 0;
	
	for(int i=0; i<n-2; i++){
		for(int j=i+1; j<n-2; j++){
			int leftSum = a[i] + a[j];
			if(leftSum <= k1) continue;
			
			for(int k=j+1; k<n-1; k++){
				for(int l=k+1; l<n; l++){
					int rightSum = a[k] + a[l];
					if(rightSum > k2 ) ans++;
				}
			}
		}
	}
	return ans;
}






//* Left Count Pre Computation  : 

//* Eg : [ 1 , 2 , 3 , 4 , 5 , 6 , 8 ]   k1 = 9

//* Ending at analogy : 
//* 	We are finding pairs (x,y) with sum x+y == k1 ending at y

//* Observation : if we drew out patterns for each pairs , it looks like this : 
//*      [ (1 , 2 , (3 , (4 , 5) , 6) , 8) ]   
//*     	y = 1,2,3,4 can't form pair with any x such that x+y >= 9
//* 	    y = 5 forms pair with x = 4 only               => ct = 1
//* 		y = 6 forms pair with x = (3, 4, 5)            => ct = 3
//* 		y = 8 forms pair with x = (1, 2, 3, 4, 5, 6)   => ct = 6

//* 	Now we can use 2 ptr from 1st pair [x, x+1] such that x + x + 1 >= k1
//* 	                i   j
//*      [ 1 , 2 , 3 , (4 , 5) , 6 , 8) ]   
//* 			p[5] = max(0, 2) = 2
//* 		Now we want to maximize p[5] cts so move i left => i--

//* 	           i        j
//*      [ 1 , 2 , 3 , (4 , 5) , 6 , 8) ]   
//* 			5+3 < k1
//* 		Invalid so move to next y => j++

//* 	                i       j
//*      [ 1 , 2 , 3 , (4 , 5 , 6) , 8) ]   
//* 			p[6] = max(0, 3) = 3

//* 	            i           j
//*      [ 1 , 2 , (3 , 4 , 5 , 6) , 8) ]   
//* 			p[6] = max(3, 4) = 4

//* 	        i               j
//*      [ 1 , (2 , 3 , 4 , 5 , 6) , 8) ]   
//* 			Invalid => j++

//* O(n + n + n ) = O(n)

// int consistency(int n, int k1, int k2) {
	
// 	int ans = 0;
	
// 	vector<int> p(n);

// 	vector<int> leftPrefix(n);
// 	int i=1;
// 	while(i<n){
// 		if(a[i] + a[i-1] >= k1) break;
// 		i++;
// 	}
// 	int left = i-1;
// 	int right = i;
	
// 	while(left>=0 && right<n){
// 		if(a[left] + a[right] > k1){
// 			p[right] = max(p[right], right-left);
// 			left--;
// 		}
// 		else {
// 			right++;
// 		}
// 	}
// 	for(int i=1; i<n; i++){
// 		leftPrefix[i] = leftPrefix[i-1] + p[i];
// 	}
	

	
// 	vector<int> q(n);

// 	vector<int> rightSufix(n);
// 	// for(int i=n-1; i>=0; i--){
// 	// 	rightSufix[i] = rightSufix[i+1] + q[i];
// 	// }
	
// 	for(int j=1; j<n-2; j++){
// 		int leftCt = leftPrefix[j];
// 		int rightCt = rightSufix[j+1]; 
		
// 		ans += leftCt * rightCt;
// 	}


// 	return ans;
	
// }

















int consistency1(int n, int k1, int k2) {
	
	//* Suffix 
	vector<int> pairsInSufix(n);
	vector<int> pairsFrom(n);
	
	int s = 0, e = n-1;
	while(e-s+1>2){
		if(a[s]+a[e] > k2)	e--;
		else s++;
	}
	int j = e;
	
	while(s>=0 && e<n){
		if(a[e] + a[s] > k2){
			pairsFrom[s] = n-e;
			s--;
		}
		else{
			e++;
		}
	}
	while(j<n){
		pairsFrom[j] = n-j-1;
		j++;
	}
	
	pairsInSufix[n-1] = pairsFrom[n-1];
	for(int i=n-2; i>=0; i--){
		pairsInSufix[i] = pairsFrom[i] + pairsInSufix[i+1];
	}
	
	
	int ans = 0;
	
	//* Global 2 Ptr * local 2 Ptr 
	for(int j=n-3, i=0; j>i; j--){
		while(i<j && a[i]+a[j] <= k1) i++;
		
		int left = j-i;
		int right = pairsInSufix[j+1];
		
		ans += left*right;
	}
	
	return ans;
}






int consistency2(int n, int k1, int k2) {
	
	//* prefix 
	vector<int> pairsInPrefix(n);
	vector<int> pairsEndingAt(n);
	
	int s = 0, e = n-1;
	while(e-s+1>2){
		if(a[s]+a[e] > k1)	e--;
		else s++;
	}
	
	while(s>=0 && e<n){
		if(a[e] + a[s] > k1){
			s--;
		}
		else{
			pairsEndingAt[e] = e-s-1;
			e++;
		}
	}
	while(e<n){
		pairsEndingAt[e] = e;
		e++;
	}
	
	
	
	
	
	//* Suffix 
	
	vector<int> pairsInSufix(n);
	vector<int> pairsFrom(n);
	
	s = 0, e = n-1;
	
	while(e-s+1>2){
		if(a[s]+a[e] > k2)	e--;
		else s++;
	}
	int y = e;
	
	while(s>=0 && e<n){
		if(a[e] + a[s] > k2){
			pairsFrom[s] = n-e;
			s--;
		}
		else{
			e++;
		}
	}
	while(y<n){
		pairsFrom[y] = n-y-1;
		y++;
	}
	
	pairsInSufix[n-1] = pairsFrom[n-1];
	for(int i=n-2; i>=0; i--){
		pairsInSufix[i] = pairsFrom[i] + pairsInSufix[i+1];
	}
	
	
	int ans = 0;
	for(int i=1; i<n-2; i++){
		int left = pairsEndingAt[i];
		int right = pairsInSufix[i+1];
		
		ans += left * right;
	}
	
	return ans;
}












int practice(int n, int k1, int k2) {
 
	return 0;
 
}










void solve() {
    
	int n, k1, k2;
	cin >> n >> k1 >> k2;
	
	a.resize(n);
	for(int i=0; i<n; i++) cin >> a[i];
    
    cout << bruteforce(n, k1, k2) << " ";
    cout << consistency1(n, k1, k2) << " ";
    cout << consistency2(n, k1, k2) << endl;
    
    
    // cout << bruteforce(n, k1, k2) << " -> ";
    // cout << practice(n, k1, k2) << endl;
    
}





int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int t = 1;
    cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}