"Monks, be islands unto yourselves, be your own refuge, having no other; let the Dhamma be an island and a refuge to you, having no other. Those who are islands unto themselves... should investigate to the very heart of things: 'What is the source of sorrow, lamentation, pain, grief and despair? How do they arise?' [What is their origin?]
"Here, monks, the uninstructed worldling [continued as in SN 22.7.] Change occurs in this man's body, and it becomes different. On account of this change and difference, sorrow, lamentation, pain, grief and despair arise. [Similarly with 'feelings,' 'perceptions,' 'mental formations,' 'consciousness'].
"But seeing the body's impermanence, its change-ability, its waning, its ceasing, he says 'formerly as now, all bodies were impermanent and unsatisfactory, and subject to change.' Thus, seeing this as it really is, with perfect insight, he abandons all sorrow, lamentation, pain, grief and despair. He is not worried at their abandonment, but unworried lives at ease, and thus living at ease he is said to be 'assuredly delivered.'" [Similarly with 'feelings,' 'perceptions,' 'mental formations,' 'consciousness'].
See also: DN 16.