For given two lines s1 and s2, print "2" if they are parallel, "1" if they are orthogonal, or "0" otherwise.

s1 crosses points p0 and p1, and s2 crosses points p2 and p3.

Constraints

* 1 ≤ q ≤ 1000
* -10000 ≤ xpi, ypi ≤ 10000
* p0 ≠ p1 and p2 ≠ p3.

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 p0, p1, p2, p3 in the following format:


xp0 yp0 xp1 yp1 xp2 yp2 xp3 yp3


Output

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

Example

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


Output

2
1
0
/*
Aoj CGL_2_A
题意 T组数据 每次给出4个点 p1,p2,p3,p4
p1与p2的向量是p_1
p3与p4的向量是p_2;
当p_1与p_2平行时输出2，正交输出1，其他输出0
可以用向量的内积和外积做这题  
*/
#include<bits/stdc++.h>
#define eps (1e-10)
using namespace std;
class Point
{
	public:
	double x,y;
	Point(double _x=0,double _y=0):x(_x),y(_y){}
	Point operator -(Point p){
		return Point(x-p.x,y-p.y);
	}
};
//判断是否正交 向量内积：a*b=|a||b|*cos(Y) 当cos为0时正交(90,-90垂直) 
//a*b=a.x*b.x+a.y*b.y;
bool solve1(Point a,Point b)
{
	double f=a.x*b.x+a.y*b.y; 
	if(fabs(f-0.0)<eps) return true;
	else return false;
}
//判断是否平行  向量外积：|a*b|=|a||b|sin(Y) 当sin为0时平行(180,0平行)
//|a*b|=|a|*|b|*sin(Y) 
bool solve2(Point a,Point b)
{
	double f=a.x*b.y-a.y*b.x;
	if(fabs(f-0.0)<eps) return true;
	else return false;
}
int main()
{
	int T;scanf("%d",&T);
	while(T--){
		double p1_x,p1_y,p2_x,p2_y,p3_x,p3_y,p4_x,p4_y;
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&p1_x,&p1_y,&p2_x,&p2_y,&p3_x,&p3_y,&p4_x,&p4_y);
		Point a1(p1_x,p1_y),a2(p2_x,p2_y),b1(p3_x,p3_y),b2(p4_x,p4_y);
		if(solve1(a1-a2,b1-b2)) printf("1\n");
		else if(solve2(a1-a2,b1-b2)) printf("2\n");
		else printf("0\n");
		
	}
	return 0;
}
