Dynamics, interrelations and evolution of the systems of asteroids and comets