FR 5357 then FR 2766 at Madrid
Krakow → Madrid → Prague
Timetable, Madrid time
17:15FR 5357 from Krakow at the gate
09:50FR 2766 to Prague leaves the gate
16 h 35 apart on the timetable, overnight
FR 2766 leaves 16 h 35 after FR 5357 arrives on the timetable: more than half a day, so not a connection we count.