FR 5898 then W4 7991 at Madrid
Torino → Madrid → Pisa
Timetable, Madrid time
17:35FR 5898 from Torino at the gate
14:10W4 7991 to Pisa leaves the gate
20 h 35 apart on the timetable, overnight
W4 7991 leaves 20 h 35 after FR 5898 arrives on the timetable: more than half a day, so not a connection we count.