Let's assume this is in the third person point of view (I'm not included). Now how do I know, between Tanaka and The teacher, is the one that will be the target of the verb and the receiver of the favor?
Alice gives the favor of showing that to Tanaka for the teacher.(For teacher's sake)
Alice gives the favor of showing that to the Teacher for Tanaka.(For Tanaka's sake)
The scenario is that "Alice shows that to Tanaka, giving/doing a favor to the teacher."