Description

Since the cubic equation: ax ^ 3 + bx ^ 2 + cx + d = 0 is given, please check the number of positive real roots and the number of negative real roots, respectively.

The number of roots shall be counted including the multiple roots.



Input

The input consists of multiple test cases, and the number is recorded on the first line.

From the second line onward, the coefficients of the cubic equation are written in the form of a b c d. a is not 0, and each number is an integer value from -100 to 100.

Output

For a given cubic equation, output the number of positive real roots and the number of negative real roots separated by a space.

Example

Input

2
1 3 3 1
-10 0 0 0


Output

0 3
0 0
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll LINF = 1e18;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const int ddx[] = {1, 1, 0, -1, -1, -1, 0, 1};
const int ddy[] = {0, 1, 1, 1, 0, -1, -1, -1};

int gcd(int a, int b) {
    if(b == 0) return a;
    return gcd(b, a % b);
}

int extgcd(int a, int b, int& x, int&y) {
    int d = a;
    if(b != 0) {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    }else {
        x = 1;
        y = 0;
    }
    return d;
}

int inv(int a) {
    int x, y;
    extgcd(a, MOD, x, y);
    return (x + MOD) % MOD;
}

int a, b, c, d;

double f(double x) {
    return a * x * x * x + b * x * x + c * x + d;
}

int judge(double x) {
    if(x > 1e-9) return 1;
    if(x < -(1e-9)) return -1;
    return 0;
}

int main() {
    int question;
    cin >> question;
    rep(quest, question) {
        cin >> a >> b >> c >> d;
        if(a < 0) {
            a = -a; b = -b; c = -c; d = -d;
        }
        int de = b * b - 3 * a * c;

        if(de < 0 || de == 0 && 2 * b * b * b - 9 * a * b * c + 27 * a * a * d != 0) {
            if (d > 0) cout << "0 1" << endl;
            else if(d == 0) cout << "0 0" << endl;
            else cout << "1 0" << endl;
        }else if(de == 0) {
            if(d > 0) cout << "0 3" << endl;
            else if(d == 0) cout << "0 0" << endl;
            else cout << "3 0" << endl;
        }else {
            double x1 = (-b - sqrt(de)) / (3 * a);
            double x2 = (-b + sqrt(de)) / (3 * a);
            if(judge(f(x1)) == -1) {
                if(d > 0) cout << "0 1" << endl;
                else if(d == 0) cout << "0 0" << endl;
                else cout << "1 0" << endl;
            }else if(judge(f(x1)) == 0) {
                if(judge(x1) == 1) cout << "3 0" << endl;
                else if(judge(x1) == 0) cout << "1 0" << endl;
                else {
                    if(d > 0) cout << "0 3" << endl;
                    else if(d == 0) cout << "0 2" << endl;
                    else cout << "1 2" << endl;
                }
            }else {
                if(judge(f(x2)) == 1) {
                    if(d > 0) cout << "0 1" << endl;
                    else if(d == 0) cout << "0 0" << endl;
                    else cout << "1 0" << endl;
                }else if(judge(f(x2)) == 0) {
                    if(judge(x2) == -1) cout << "0 3" << endl;
                    else if(judge(x2) == 0) cout << "0 1" << endl;
                    else {
                        if(d > 0) cout << "2 1" << endl;
                        else if(d == 0) cout << "2 0" << endl;
                        else cout << "3 0" << endl;
                    }
                }else {
                    if(judge(x1) == 1) {
                        if(d > 0) cout << "2 1" << endl;
                        else if(d == 0) cout << "2 0" << endl;
                        else cout << "3 0" << endl;
                    }else if(judge(x1 == 0)) cout << "2 0" << endl;
                    else {
                        if(judge(x2) == -1) {
                            if(d > 0) cout << "0 3" << endl;
                            else if(d == 0) cout << "0 2" << endl;
                            else cout << "1 2" << endl;
                        }else if(judge(x2) == 0) cout << "1 2" << endl;
                        else {
                            if(d > 0) cout << "2 1" << endl;
                            else if(d == 0) cout << "1 1" << endl;
                            else cout << "1 2" << endl;
                        }
                    }
                }
            }
        }
    }
}

