import Data.List (sort)
import Control.Applicative ((<$>))

main :: IO ()
main = do
  queries <- map (map read . words) . lines <$> getContents
  putStrLn $ solve queries
  
solve :: [[Int]] -> String
solve = go 0 0 0 0
  where
    go n x y z (q:qs)
      | (b - a) ^ 2 < c ^ 2 && c ^ 2 < a ^ 2 + b ^ 2
        = go (n + 1) (x + 1) y z qs
      | c ^ 2 == a ^ 2 + b ^ 2
        = go (n + 1) x (y + 1) z qs
      | a ^ 2 + b ^ 2 < c ^ 2 && c ^ 2 < (a + b) ^ 2
        = go (n + 1) x y (z + 1) qs
      | otherwise
        = unwords $ map show [n, y, x, z]
      where
        [a, b, c] = sort q
