let to_array s = Str.split (Str.regexp_string " ") s
                 |> List.map float_of_string
                 |> Array.of_list;;
let is_parallel x1 y1 x2 y2 x3 y3 x4 y4 =
  let prod =(x2 -. x1) *. (y4 -. y3) -. (x4 -. x3) *. (y2 -. y1) in
  if prod < (1e-10) && prod > -.(1e-10) then true else false;;

let is_orthogonal x1 y1 x2 y2 x3 y3 x4 y4 =
  let inner_prod = (x2 -. x1) *. (x4 -. x3) +. (y2 -. y1) *. (y4 -. y3) in
  if inner_prod < (1e-10) && inner_prod > -.(1e-10) then true else false

let rec read = function
    0 -> ()
  | i -> let l = read_line () |> to_array in
         let (x1,y1,x2,y2,x3,y3,x4,y4) = (l.(0),l.(1),l.(2),l.(3),l.(4),l.(5),l.(6),l.(7))
         in
         let () = if is_parallel x1 y1 x2 y2 x3 y3 x4 y4 then print_endline "2"
                  else if is_orthogonal x1 y1 x2 y2 x3 y3 x4 y4 then print_endline "1"
                  else print_endline "0"
         in read (i-1);;
let () = read_int () |> read;;