FR 6712 then FR 3831 at Madrid
Budapest → Madrid → Bologna
Timetable, Madrid time
18:10FR 6712 from Budapest at the gate
14:45FR 3831 to Bologna leaves the gate
20 h 35 apart on the timetable, overnight
FR 3831 leaves 20 h 35 after FR 6712 arrives on the timetable: more than half a day, so not a connection we count.