import Control.Monad (replicateM)

main = do
    replicateM 3 $ do
        nums <- return . map read . words =<< getLine
        let hms1 = take 3 nums
        let hms2 = drop 3 nums
        let hmsd = secToHms ((hmsToSec hms2) - (hmsToSec hms1))
        (putStrLn . unwords . map show) hmsd
    
hmsToSec :: [Int] -> Int
hmsToSec [h,m,s] = h * 3600 + m * 60 + s

secToHms :: Int -> [Int]
secToHms ts = [ts `div` 3600, ts `mod` 3600 `div` 60, ts `mod` 60]