Node snapping will help. Enable the following from the node snapping toolbar:
- Enable snapping %, the first button in the toolbar.
- Snap nodes, paths and handles (important!)
- Snap to paths
- Snap cusp nodes
- Snap smooth nodes
- Snap other points...
- Snap an item's rotation center (important!)
Some of the above snapping options may be unneeded, and depend on your path.
Now, select path A twice so you can see the rotation handles and the rotation center.
Drag the rotation center to one of the endpoints of line segment I; snapping should get you exactly there.
Now, drag the whole path so that the rotation center snaps to line segment q.
Now you can rotate path A so that the other endpoint of line segment I snaps to line segment q.
If q is too short compared to I, you can duplicate q and transform it into a guide (shifg-G). Now you can drag this guide and keep the angle. Snap to the guide rather than q (after enabling snap to guides).