FR 5316 then FR 2513 at Madrid
Rome → Madrid → Bucharest
Timetable, Madrid time
23:40FR 5316 from Rome at the gate
16:50FR 2513 to Bucharest leaves the gate
17 h 10 apart on the timetable, overnight
FR 2513 leaves 17 h 10 after FR 5316 arrives on the timetable: more than half a day, so not a connection we count.