First, there is no “right” of way.
It’s about etiquette and not about rights.
This is etiquette whose purpose is safety for all pilots.
Anyhow, upper pilots must always yield to lower pilots climbing up from beneath so they may climb through their track. Also, the proximity to terrain combined with drift gives the lower pilot a second courtesy cause to yield by the upper pilot.
My 2p worth