FR 3877 then FR 188 at Madrid
Tangier → Madrid → Edinburgh
Timetable, Madrid time
16:10FR 3877 from Tangier at the gate
10:30FR 188 to Edinburgh leaves the gate
18 h 20 apart on the timetable, overnight
FR 188 leaves 18 h 20 after FR 3877 arrives on the timetable: more than half a day, so not a connection we count.