let
max_elt s =
let
(_, n), _ = split_rightmost s
in
n