FR 9601 then IB 7849 at Madrid
Rome → Madrid → Riga
Timetable, Madrid time
19:10FR 9601 from Rome at the gate
17:15IB 7849 to Riga leaves the gate
22 h 05 apart on the timetable, overnight
IB 7849 leaves 22 h 05 after FR 9601 arrives on the timetable: more than half a day, so not a connection we count.