Problem8547--CGL_2_A : Parallel/Orthogonal

8547: CGL_2_A : Parallel/Orthogonal

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

For given two lines $s_1$ and $s_2$, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise.
$s_1$ crosses points $p_0$ and $p_1$, and $s_2$ crosses points $p_2$ and $p_3$.

Input

The entire input looks like:
q(the number of queries) 
1st query 
2nd query 
...
qth query

Each query consists of integer coordinates of the points $p_0, p_1, p_2, p_3$ in the following format:
$x_{p_0}\ y_{p_0}\ x_{p_1}\ y_{p_1}\ x_{p_2}\ y_{p_2}\ x_{p_3}\ y_{p_3}$

Output

For each query, print "2", "1" or "0".

Constraints

$1 ≤ q ≤ 1000$
$-10000 ≤ x_{p_i}, y_{p_i} ≤ 10000$
$p_0≠p_1$ and $p_2≠p_3$.

Sample 1 Input

3
0 0 3 0 0 2 3 2
0 0 3 0 1 1 1 4
0 0 3 0 1 1 2 2

Sample 1 Output

2
1
0

HINT

相同题目:CGL_2_A

Source/Category