The teaching is from the Milindapañha.
'Venerable Nāgasena, these givers when they bestow their offerings, devote them specifically to former (relatives) now departed, saying: "May this gift benefit such and such." Now do they (the dead) derive any benefit therefrom?'
'Some do, O king, and some do not.'
'Which then are they that do, and which do not?'
'Those who have been reborn in purgatory, O king, do not; nor those reborn in heaven; nor those reborn as animals. And of those reborn as Pretas three kinds do not: the Vantāsikā (who feed on vomit), the Khuppipāsino (who hunger and thirst.), the Nijjhāmatañhikā (who are consumed by thirst). But the Paradattūpajīvino (who live on the gifts of others) they do derive profit, and those who bear them in remembrance do so too.'
'Then, Nāgasena, offerings given by the givers have run to waste, and are fruitless, since those for whose benefit they are given derive no profit therefrom.'
'No, O king. They run not to waste, neither are fruitless. The givers themselves derive profit from them.'
(Mil. 294-7, Th. Rhys Davids trans.)
For the full dialogue:http://www.sacred-texts.com/bud/sbe36/sbe3606.htm
sɑrɑ̄: ɑ ɑ̄ i ī u ū e o
kɑɳȶɑjɑ̄: k ƙ ɡ ɠ ŋ
tɑ̄lujɑ̄: c ƈ j j̛ ɲ
mudɗɑjɑ̄: ʈ ȶ ɖ ȡ ɳ
dɑntɑjɑ̄: t ƭ d ɗ n
oʈȶɑjɑ̄: p ƥ b ɓ m
ɑvɑɡɡɑ̄: y r l v s h ł
niɡɡɑhītɑ̊: ɑ̊ i̊ ů