Carlos Alcaraz and Jannik Sinner come through tough tests at the Shanghai Masters to reach the last 16.