else , we query between node u and head of the chain to which u belongs and later change u to parent of head of the chain to which u belongs indicating change of chain
else { ans = max ( ans , RMQ ( node [ chain_heads [ chain_u ] ] . pos_segbase , node [ u ] . pos_segbase , n ) ) ; u = node [ chain_heads [ chain_u ] ] . par ; } } return ans ; }