FR 3877 then FR 5713 at Madrid
Tangier → Madrid → Budapest
Timetable, Madrid time
22:35FR 3877 from Tangier at the gate
20:10FR 5713 to Budapest leaves the gate
21 h 35 apart on the timetable, overnight
FR 5713 leaves 21 h 35 after FR 3877 arrives on the timetable: more than half a day, so not a connection we count.