So what I would suggest to you is that you take some time and read up on the apple documentation concerning delegates. They will do exactly what you want here where two views can have the same child view. From there have the child view call the delegate to figure out what it needs to do.
Another thing to keep in mind is that it is good practice to have any view that pushes a view to also be the one responsible for popping that view.
EDIT: Just to help you with your original question and get you thinking down the right path. When the back button is pressed in Class D. You would want it to call a method on the delegate (which could be either class A or Class B) from there you could make it go to either the same class. Or if you want to present another view have the delegate view present Class C. Using delegates allows you to have Class A present Class C while allowing Class B to just stay at B when back is pressed. I hope this answers your question.