p01337 The Number of the Real Roots of a Cubic Equation
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
```python
n=int(input())
def f(a,b,c,d):
    return lambda x:a*x**3+b*x**2+c*x+d
for i in range(n):
    a,b,c,d=map(int,input().split())
    fx=f(a,b,c,d)
    D=b**2-3*a*c
    if D<=0 :
        if d==0:
            pl=mi=0
        elif (a>0 and d<0) or (a<0 and d>0):
            pl,mi=1,0
        elif (a<0 and d<0) or (a>0 and d>0):
            pl,mi=0,1
    else:
        if a>0:
            al=(-b-D**0.5)/(3*a)
            be=(-b+D**0.5)/(3*a)
            if (fx(al)<0 or fx(be)>0) and d==0:
                pl=mi=0
            elif ((fx(al)<0 or fx(be)>0) and d>0) or (fx(be)==0 and d==0 and be==0):
                pl,mi=0,1
            elif (fx(al)==0 or (fx(al)>0 and fx(be)<0)) and d==0 and be<0:
                pl,mi=0,2
            elif (fx(al)==0 or fx(be)==0 or (fx(al)>0 and fx(be)<0)) and d>0 and be<0:
                pl,mi=0,3
            elif ((fx(al)<0 or fx(be)>0) and d<0) or (fx(al)==0 and d==0 and al==0):
                pl,mi=1,0
            elif fx(al)>0 and fx(be)<0 and d==0 and al<0 and be>0:
                pl=mi=1
            elif (fx(al)==0 or (fx(al)>0 and fx(be)<0)) and d<0 and al<0:
                pl,mi=1,2
            elif (fx(be)==0 or (fx(al)>0 and fx(be)<0)) and d==0 and al>0:
                pl,mi=2,0
            elif (fx(be)==0 or (fx(al)>0 and fx(be)<0)) and d>0 and be>0:
                pl,mi=2,1
            elif ((fx(al)==0 and al>0) or fx(be)==0 or (fx(al)>0 and fx(be)<0 and al>0)) and d<0:
                pl,mi=3,0
        else:
            al=(-b+D**0.5)/(3*a)
            be=(-b-D**0.5)/(3*a)
            if (fx(al)>0 or fx(be)<0) and d==0:
                pl=mi=0
            elif ((fx(al)>0 or fx(be)<0) and d<0) or (fx(be)==0 and d==0 and be==0):
                pl,mi=0,1
            elif (fx(al)==0 or (fx(al)<0 and fx(be)>0)) and d==0 and be<0:
                pl,mi=0,2
            elif (fx(al)==0 or fx(be)==0 or (fx(al)<0 and fx(be)>0)) and d<0 and be<0:
                pl,mi=0,3
            elif ((fx(al)>0 or fx(be)<0) and d>0) or (fx(al)==0 and d==0 and al==0):
                pl,mi=1,0
            elif fx(al)<0 and fx(be)>0 and d==0 and al<0 and be>0:
                pl=mi=1
            elif (fx(al)==0 or (fx(al)<0 and fx(be)>0)) and d>0 and al<0:
                pl,mi=1,2
            elif (fx(be)==0 or (fx(al)<0 and fx(be)>0)) and d==0 and al>0:
                pl,mi=2,0
            elif (fx(be)==0 or (fx(al)<0 and fx(be)>0)) and d<0 and be>0:
                pl,mi=2,1
            elif (fx(al)==0 or fx(be)==0 or (fx(al)<0 and fx(be)>0)) and d>0 and al>0:
                pl,mi=3,0
    print(pl,mi)

```