D
# f[m_] := Apply[BitXor, Table[n, {n, 1, m}]]
# f /@ Range[50]
# FindSequenceFunction[%, n] // FullSimplify
# https://oeis.org/A003815
# a(0)=0, a(4n+1)=1, a(4n+2)=4n+3, a(4n+3)=0, a(4n+4)=4n+4, n >= 0.
def a(n):
if n == 0:
return 0
elif n % 4 == 1:
return 1
elif n % 4 == 2:
return n ^ (n + 1)
elif n % 4 == 3:
return 0
elif n % 4 == 0:
return n
def xor_upto(n):
if n == 0:
return 0
elif n % 4 == 0:
return n
elif n % 4 == 1:
return 1
elif n % 4 == 2:
return n + 1
elif n % 4 == 3:
return 0
def xor_range(l, r):
return xor_upto(r) ^ xor_upto(l - 1)
t = int(input())
while t > 0:
t -= 1
l, r = map(int, input().split())
result = xor_range(l, r)
print(result)
E
# fx = -a2*x - c2 - (a1*x^2 + b1*x + c1)*b2;
# Collect[fx, x]
# Discriminant[fx, x]
# -b2 c1 - c2 + (-a2 - b1 b2) x - a1 b2 x^2
def func(a1, b1, c1, a2, b2, c2):
A=-a1*b2
B=(-a2-b1*b2)
C=(-b2*c1-c2)
D=B*B-4*A*C
Discriminant=B*B-4*A*C
if A==0:
if B==0:
if C==0:
return "INF"
else:
return 0
else:
return 1
elif D==0:
return 1
elif D>=0:
return 2
elif D<0:
return 0
t = int(input())
while t:
t -= 1
a1, b1, c1, a2, b2, c2 = map(int, input().split())
print(func(a1, b1, c1, a2, b2, c2))