FR 2540 then FR 9472 at Madrid
Bucharest → Madrid → Pisa
Timetable, Madrid time
13:55FR 2540 from Bucharest at the gate
13:00FR 9472 to Pisa leaves the gate
23 h 05 apart on the timetable, overnight
FR 9472 leaves 23 h 05 after FR 2540 arrives on the timetable: more than half a day, so not a connection we count.