import Data.List import Control.Applicative check :: Integral a => (a, a) -> (a, a) -> (a, a) -> Maybe (a, a) check (x1, y1) (x2, y2) (x3, y3) | (x1 - x2) ^ 2 + (y1 - y2) ^ 2 == (x3 - x2) ^ 2 + (y3 - y2) ^ 2 && (x1 - x2) * (x3 - x2) + (y1 - y2) * (y3 - y2) == 0 = Just (x1 + x3 - x2, y1 + y3 - y2) | otherwise = Nothing func :: Maybe a -> Maybe a -> Maybe a Nothing `func` Nothing = Nothing Nothing `func` x = x x `func` y = x main = do [x1, y1, x2, y2, x3, y3] <- return . map (read::String->Int) . words =<< getLine let p = foldl1 func $ fmap (\(p1:p2:p3:_) -> check p1 p2 p3) $ permutations [(x1, y1), (x2, y2), (x3, y3)] putStrLn $ case p of Just (x, y) -> unwords [show x, show y] Nothing -> "-1"