#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << "\n"
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef complex<ld> Point;
typedef pair<Point, Point> Segment;
constexpr double EPS = (1e-9L);
ld dot(const Point& p1, const Point& p2) { return (conj(p1) * p2).real(); }
ld cross(const Point& p1, const Point& p2) { return (conj(p1) * p2).imag(); }
constexpr bool eq(ld a) { return abs(a) < EPS; }
int main() {
	int n; cin >> n;
	int xa, ya, xb, yb;
	Point v[2];
	rep(i, 0, n) {
		rep(j, 0, 2) { cin >> xa >> ya >> xb >> yb; v[j] = Point(xb, yb) - Point(xa, ya); }
		if (eq(cross(v[0], v[1]))) P(2);
		else if (eq(dot(v[0], v[1]))) P(1);
		else P(0);
	}
	return 0;
}