Solution:
Concept: Each prism deviates a ray towards its own base. Two identical prisms placed the opposite way round, with their facing sides parallel, turn the ray through equal angles in opposite directions.
Step 1 — Prism A.
PQ enters prism A and is deviated towards its base. Prism A is inverted (base on top), so the ray is turned upward.
Step 2 — The gap.
The ray leaves prism A, crosses the air gap and enters prism B through the face parallel to A's second face.
Step 3 — Prism B.
Prism B is upright (base at the bottom), so it deviates the ray downward, towards its base, by the same angle.
Step 4 — Result.
The two deviations cancel. The ray emerges from B parallel to PQ, only shifted sideways, as in a glass slab.

Therefore, the ray emerges from prism B parallel to the incident ray PQ, displaced sideways.