FR 5322 then W4 3174 at Madrid
Milan → Madrid → Bucharest
Timetable, Madrid time
19:45FR 5322 from Milan at the gate
18:35W4 3174 to Bucharest leaves the gate
22 h 50 apart on the timetable, overnight
W4 3174 leaves 22 h 50 after FR 5322 arrives on the timetable: more than half a day, so not a connection we count.