FR 2540 then FR 267 at Madrid
Bucharest → Madrid → Valletta
Timetable, Madrid time
13:55FR 2540 from Bucharest at the gate
09:45FR 267 to Valletta leaves the gate
19 h 50 apart on the timetable, overnight
FR 267 leaves 19 h 50 after FR 2540 arrives on the timetable: more than half a day, so not a connection we count.