#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;

#define endl '\n'

double j, p, H, L, v;

double g = 9.81;

double h(double l) {
	if (l < 0) return H;
	if (l < L/2) return H*(1-2*(l/L)*(l/L));
	if (l < L) return 2*H*((l/L)-1)*((l/L)-1);
	return 0;
}

double f(double l) {
	return -1* g/2 * (l/v) * (l/v) + H + p;
}

double dH(double l) {
	if (l < 0) return 0;
	if (l < L / 2) return -4*H*l/(L*L);
    if (l < L) return 4*H*l/(L*L) - 4*H/L;
    return 0;
}

int main() {
	ios::sync_with_stdio(0);
	int t; cin >> t;
	while(t--) {
		cin >> j >> p >> H >> L;
		v = sqrt(2 * g * j);
		double maxl, minl, l;
		maxl = v * sqrt(2*(H+p)/g);
		minl = 0;
		l = (maxl + minl) / 2;
		while(abs(f(l) - h(l)) >1E-5) {
			if (f(l) > h(l)) {
				minl = l;
				l = (maxl + minl) / 2;
			} else {
				maxl = l;
				l = (maxl + minl) / 2;
			}
		}
		double height = j+p+H-h(l);
		double vl = sqrt(2*g*height);
		double angleh = atan(-dH(l));
		double anglev = atan(g*l/v/v);

		cout << fixed << setprecision(7) << l << " "<< vl <<" "<< (anglev-angleh)*180/3.1415926535 << endl;

	}
	return 0;
}