#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

ld a, b, c, d;

ld f(ld x){
    return a*pow(x, 3)+b*pow(x, 2)+c*x+d;
}

ld binary_search(ld s, ld t, bool rev = false){
    ld l = s, r = t;
    while(r-l > EPS){
        ld m = (l+r)/2;
        bool tmp = f(m) > 0;
        if(tmp^rev) r = m;
        else l = m;
    }
    return l;
}

int main(){
    int T;
    cin >> T;
    while(T--){
        cin >> a >> b >> c >> d;
        if(a < 0) a = -a, b = -b, c = -c, d = -d;
        ll D = b*b-3*a*c;
        vector<ld> ans;
        if(D < -EPS){
            ans.pb(binary_search(-200, 200));
        }
        elif(abs(D) < EPS){
            ll x = -b/(3*a);
            if(abs(f(x)) < EPS){
                rep(i, 2) ans.pb(x);
            }
            ans.pb(binary_search(-200, 200));
        }
        else{
            ld s = (-b-sqrt(D))/(3*a), t = (-b+sqrt(D))/(3*a);
            if(f(s) > -EPS){
                ans.pb(binary_search(-200, s));
            }
            if(f(s) > -EPS && f(t) < EPS){
                ans.pb(binary_search(s, t, true));
            }
            if(f(t) < EPS){
                ans.pb(binary_search(t, 200));
            }
        }
        int p = 0, n = 0;
        for(auto &e: ans){
            if(e > 1e-3) p++;
            if(e < -1e-3) n++;
        }
        cout << p << ' ' << n << endl;
    }
}
