Can a spell keep track of its target if the target changes controller?
Yes. An object that changes controllers is still the same object, so a spell that targeted it will continue to target it.
Assassin's Trophy checks who controls the targeted permanent as the spell resolves, so in this scenario opponent B will fetch the basic land.