Tensor invariants and integration of differential equations