The correct answer is The ruling king's heir was one of the king's sisters' sons
This was done if the king's sisters had sons and if the king had sisters at all, but mostly they all did and it worked like a charm until the Ghana kingdom eventually broke when the dynasties were conquered. Sometimes this wasn't the case but they found a way to solve it too through other hereditary means and through other family members.