The twenty ninth sutta of the Dīghanikāya.
Cunda-Samaṇuddesa, who had been spending the rainy season at Pāvā, returns and reports to Ānanda the death of Nigaṇṭha Nāṭaputta and the consequent wrangling that had broken out among the Nigaṇṭhā. Together they visit the Buddha at Sāmagāma and tell him of it. He replies that this is to be expected from the character of Nāṭaputta and from the doctrine that he taught. The Buddha then proceeds to give in detail the qualities of the perfect teacher and the perfect teaching. The Tathāgata is such a teacher and the Dhamma such a teaching (D.iii.117‑41).
In the Pāsādika Sutta the threefold training is called brahmacariya. DA.i.179; MA.i.275.
See also the Sāmagāma Sutta.