import           Control.Applicative
import           Control.Monad
import qualified Data.ByteString.Char8 as B
import           Text.Printf

readi :: B.ByteString -> Int
readi b | Just (n, _) <- B.readInt b = n

dot :: (Double, Double) -> (Double, Double) -> Double
(a, b) `dot` (c, d) = a * c + b * d

cross :: (Double, Double) -> (Double, Double) -> Double
(a, b) `cross` (c, d) = a * d - b * c

main :: IO ()
main = do
    n <- readLn
    replicateM_ n $ do
        [a,b,c,d,e,f,g,h] <- fmap (fromIntegral . readi) . B.words <$> B.getLine
        let v1 = (c - a, d - b)
        let v2 = (g - e, h - f)
        case () of
            _ | v1 `dot` v2   == 0 -> putStrLn "1"
              | v1 `cross` v2 == 0 -> putStrLn "2"
              | otherwise          -> putStrLn "0"

