Newtonian and Lagrangian Neural Networks: A Comparison Towards Efficient Inverse Dynamics Identification