main :: IO ()
main = do
    [inpFile] <- getArgs
    input <- readFile inpFile
    putStr . unlines . map (show . lca 0 . map read . words) $ lines input
main :: IO ()
main = do
    [inpFile] <- getArgs
    input <- readFile inpFile
    putStr . unlines . map (show . lca 0 . map read . words) $ lines input
main = do
    [inpFile] <- getArgs
    input <- readFile inpFile
    putStr . unlines . map (show . lca 0 . map read . words) $ lines input