#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
double a, b, c, d;
double f(double x){
  return a*x*x*x + b*x*x + c*x + d;
}
double df(double x){
  return 3*a*x*x + 2*b*x + c;
}
int main(){
  int n;
  cin>>n;
  REP(time, n){
    cin>>a>>b>>c>>d;
    double ax[3] = {};
    REP(i, 1000){
      if(abs(df(ax[0])) < EPS) break;
      ax[0] = ax[0] - f(ax[0])/df(ax[0]);
    }
    double A = a;
    double B = b + A * ax[0];
    double C = c + B * ax[0];
    double D = B*B - 4*A*C;
    if(abs(D) < EPS) D = 0;
    //printf("%lf %lf %lf -> %lf\n",A,B,C,D);
    if(D >= 0){
      D = sqrt(D);
      ax[1] = (-B + D)/(2*A);
      ax[2] = (-B - D)/(2*A);
    }
    pair<int,int> ans;
    REP(i, 3){
      //cout<<ax[i]<<endl;
      if(ax[i] > EPS) ans.first += 1;
      if(ax[i] < -EPS) ans.second += 1;
    }
    printf("%d %d\n",ans.first, ans.second);
  }
  return 0;
}