FR 5712 then AA 8636 at Madrid
Budapest → Madrid → Rome
Timetable, Madrid time
19:00FR 5712 from Budapest at the gate
13:05AA 8636 to Rome leaves the gate
18 h 05 apart on the timetable, overnight
AA 8636 leaves 18 h 05 after FR 5712 arrives on the timetable: more than half a day, so not a connection we count.