AZ 58 then FR 8345 at Madrid
Rome → Madrid → Krakow
Timetable, Madrid time
10:50AZ 58 from Rome at the gate
10:10FR 8345 to Krakow leaves the gate
23 h 20 apart on the timetable, overnight
FR 8345 leaves 23 h 20 after AZ 58 arrives on the timetable: more than half a day, so not a connection we count.