main = getContents >>= putStrLn . solve . map words . lines solve :: [[String]] -> String solve [(sa : pa : _), (sb : pb : _)] | pa < pb = sb | pa > pb = sa | otherwise = "-1" where pa' = read pa :: Int pb' = read pb :: Int