```#include <iostream>
#include <iomanip>
#include <complex>
#include <cmath>

using namespace std;
typedef long double ld;
typedef complex<ld> pt;
const ld g = 9.81L;
const ld EPS = 1e-9;

ld fh(ld j, ld p, ld h, ld l, ld x) {
if (x < 0) return h;
if (x < l/2) return h*(1.L-2.L*(x/l)*(x/l));
if (x < l) return 2.L*h*(x/l-1.L)*(x/l-1.L);
return 0.L;
}

ld dfh(ld j, ld p, ld h, ld l, ld x) {
if (x < 0) return 0;
if (x < l/2) return h*(-2.L/l/l*2*x);
if (x < l) return 2.L*h*2.L*(x/l-1.L)/l;
return 0.L;
}

ld ff(ld j, ld p, ld h, ld l, ld v0, ld x) {
return -g/2.L*(x/v0)*(x/v0) + h + p;
}

ld dff(ld j, ld p, ld h, ld l, ld v0, ld x) {
return -g/2.L*2*(x/v0)/v0;
}

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

int ncase; cin >> ncase;
for (int csnum = 1; csnum <= ncase; csnum++) {
int j, p, h, l; cin >> j >> p >> h >> l;
ld v0 = sqrt(2.L*g*j);
ld lb = 0, rb = 1e9;
while (rb-lb > EPS) {
double mid = (lb+rb)/2;
double z = ff(j,p,h,l,v0,mid) - fh(j,p,h,l,mid);
if (z > 0) lb = mid;
else rb = mid;
}
ld x = (lb+rb)/2;
ld hend = ff(j,p,h,l,v0,x);
ld vend = sqrt(2.L*g*(j+p+h-hend));
pt vec1(1.L, dfh(j,p,h,l,x));
pt vec2(1.L, dff(j,p,h,l,v0,x));
ld ang = acos((vec1.real()*vec2.real()+vec1.imag()*vec2.imag())/abs(vec1)/abs(vec2))*180.L/acos(-1);
cout << setprecision(16) << fixed << x << " " << vend << " " << ang << endl;
}
}
```