It is a core Buddhist teaching that appears in many Suttas, for example:
Dhammapada XX, Maggavagga: The Path, verse 277:
When you see with discernment,
‘All fabrications are inconstant’ —
you grow disenchanted with stress.
This is the path
to purity.
When you see with discernment,
‘All fabrications are stressful’ —
you grow disenchanted with stress.
This is the path
to purity.
When you see with discernment,
‘All phenomena are not-self’ —
you grow disenchanted with stress.
This is the path
to purity.
https://accesstoinsight.org/tipitaka/kn/dhp/dhp.20.than.html
And:
“Bhikkhus, how do you conceive it: is form permanent or impermanent?” — “Impermanent, venerable Sir.” — “Now is what is impermanent painful or pleasant?” — “Painful, venerable Sir.” — “Now is what is impermanent, what is painful since subject to change, fit to be regarded thus: ‘This is mine, this is I, this is my self’”? — “No, venerable sir.”
"Is feeling permanent or impermanent?..
"Is perception permanent or impermanent?..
"Are determinations permanent or impermanent?..
“Is consciousness permanent or impermanent?” — “Impermanent, venerable sir.” — “Now is what is impermanent pleasant or painful?” — “Painful, venerable sir.” — “Now is what is impermanent, what is painful since subject to change, fit to be regarded thus: ‘This is mine, this is I, this is my self’”? — “No, venerable sir.”
"So, bhikkhus any kind of form whatever, whether past, future or presently arisen, whether gross or subtle, whether in oneself or external, whether inferior or superior, whether far or near, must with right understanding how it is, be regarded thus: ‘This is not mine, this is not I, this is not myself.’
"Any kind of feeling whatever…
"Any kind of perception whatever…
"Any kind of determination whatever…
"Any kind of consciousness whatever, whether past, future or presently arisen, whether gross or subtle, whether in oneself or external, whether inferior or superior, whether far or near must, with right understanding how it is, be regarded thus: ‘This is not mine, this is not I, this is not my self.’
https://www.accesstoinsight.org/tipitaka/sn/sn22/sn22.059.nymo.html
Renaldo