The Taittiriya Upanishad gives a departing student four instructions: Matru devo bhava. Pitru devo bhava. Acharya devo bhava. Atithi devo bhava. Treat the mother as a god. Treat the father as a god. Treat the teacher as a god. Treat the guest as a god.
The lines come from the Shiksha Valli, section 1.11.2, an instruction to a student leaving his teacher.