#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;
}




//* Global 2 ptr * local 2 ptr

//* O(n^2)

//* [ 1 2 2 2 3 ] , k1 = 3, k2 = 3

//*     i      j   | s e
//* [ ( 1 2 2  2 ) |(2 3) ]
//*     	2      *  1

//*       i j   | s   e
//* [ 1 ( 2 2 ) |(2 2 3) ]
//*        1    *   3

int consistency1(int n, int k1, int k2) {
	
	int ans = 0;

	int i = 0, j = n-3;

	while(i<j){
		if(a[i] + a[j] <= k1){
			i++;
		}
		else{
			int right = 0;
			int s = j+1;
			int e = n-1;
			while(s<e){
				if(a[s]+a[e] <= k2){
					s++;
				}
				else{
					right += e-s;
					e--;
				}
			}
			
			int left = j-i;
			
			ans += left*right;
			
			j--;
		}
	}


	return ans;
	
}



//* template 2
int consistency2(int n, int k1, int k2) {
	
	int ans = 0;
	
	for(int j=n-3, i=0; j>=1; j--){
		int left = 0;
		while(i<j && a[i]+a[j] <= k1) i++;
		if(i==j) break;
		left += j-i;
		
		int right = 0;
		int s = j+1, e = n-1;
		while(s<e){
			if(a[s] + a[e] <= k2) s++;
			else {
				right += e-s;
				e--;
			}
		}
		
		ans += (left * right);
		
	}
	
	return ans;
	
}







//* O(n^2)
int consistency3(int n, int k1, int k2) {
	
	int ans = 0;
	for(int j=1; j<n-2; j++){
		int i=0;
		while(i<j && a[i]+a[j] <= k1) i++;
		int left = j-i;
		
		int  s= j+1, e = n-1;
		int right = 0;
		while(s<e){
			if(a[s]+a[e] > k2){
				right += (e-s);
				e--;
			}
			else{
				s++;
			}
		}
		ans += left * right;
	}
	
	return ans;
}




























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


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) << " ";
    cout << consistency3(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;
}