main(a,b,c,d,e,f,g,h,n){scanf("%d",&n);while(n--){scanf("%d%d%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f,&g,&h);if((c-a)*(g-e)==-(d-b)*(h-f)){printf("1\n");}else if((c-a)*(h-f)==(d-b)*(g-e)){printf("2\n");}else{printf("0\n");}}}