#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
#define dbg(x...) do { cout << "\033[32;1m" << #x <<" -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<class T, class... Ts> void err(const T& arg,const Ts&... args) { cout << arg << " "; err(args...); }

typedef long double db;
const db eps = 1e-8;
const db pi = acosl(-1.0);
int sgn(db x){if(fabs(x) < eps) return 0; return x < 0 ? -1 : 1;}
struct Point{
    db x, y;
    Point(){}
    Point(db x, db y):x(x), y(y){}
    void input(){cin >> x >> y;}
    Point operator - (const Point &b) const{
        return Point(x - b.x, y - b.y);
    }
    Point operator + (const Point &b) const{
        return Point(x + b.x, y + b.y);
    }
    db operator ^ (const Point&b)const{
        return x * b.y - y * b.x;
    }
    db operator * (const Point &b) const{
        return x * b.x + y * b.y;
    }
    db len2(){
        return x * x + y * y;
    }
    db len(){
        return sqrtl(len2());
    }
};
struct Line{
    Point s, e;
    Line(){};
    Line(Point s, Point e) :s(s), e(e){}
    void input(){ s.input(); e.input(); }
    int isParallel(Line v) {
        db val = (e - s) ^ (v.e - v.s);
        if(sgn(val) == 0) return 2;
        if(sgn(fabs(val) - (e - s).len() * (v.e - v.s).len()) == 0) return 1;
        return 0;
    }
}l1, l2;


int main(){
#ifndef ONLINE_JUDGE
//freopen("i.in","r",stdin);
//  freopen("o.out","w",stdout);
#endif
    
    int T;scanf("%d", &T);
    while(T--){
        l1.input(); l2.input();
        cout << l1.isParallel(l2) << endl;
    }

    return 0;
}
