Crossing periodic orbits via first integrals