Function to get LCA
def LCA ( x : int , y : int ) -> int : NEW_LINE INDENT if h [ x ] > h [ y ] : NEW_LINE INDENT x , y = y , x NEW_LINE DEDENT return e [ RMQ ( 0 , len ( l ) - 1 , h [ x ] , h [ y ] , 0 ) ] NEW_LINE DEDENT