        | child `elem` vertices = acc ++ [parent]
        | otherwise = acc

children :: [Int] -> [Int]
children vertices = foldr go [] e
  where
    go (parent, child) acc
        | parent `elem` vertices = acc ++ [child]
        | otherwise = acc

main :: IO ()
main = print