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

typedef long double ld;

const ld g = 9.81;

ld j, p, H, L, v0;

inline ld h(ld 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;
}

inline ld hp(ld l) {
  if (l < 0)
    return 0;
  if (l < L/2)
    return -4*H*l/L/L;
  if (l < L)
    return 4*H*(l/L-1)/L;
  return 0;
}

inline ld f(ld l) {
  return -(g/2)*(l/v0)*(l/v0)+H+p;
}

int main() {
  int t; scanf("%d", &t);
  while (t--) {
    scanf("%Lf%Lf%Lf%Lf", &j, &p, &H, &L);
    v0 = sqrt(2*g*j);
    ld l;
    if (f(L/2) <= h(L/2))
      l = sqrt(p/(g/(2*v0*v0)-2*H/L/L));
    else if (f(L) <= 0) {
      ld A = 2*H/L/L+g/2/v0/v0;
      ld B = -4*H/L;
      ld C = H-p;
      l = (-B+sqrt(B*B-4*A*C))/2/A;
    }
    else
      l = sqrt(2*v0*v0*(H+p)/g);
    ld vy = g*l/v0;
    ld vt = atan2(vy,v0);
    ld ht = atan(-hp(l));
    printf("%.8Lf %.8Lf %.8Lf\n", l, sqrt(vy*vy+v0*v0), 180*(vt-ht)/acos(-1));
  }
  return 0;
}