All perfect praise be to Allah, Lord of all Creations, and may His peace and blessings be upon our Master Prophet Mohammad and all his companions and folks.
A bequest is one of the good deeds that a person does to make up for missed acts of righteousness and to receive more reward from Almighty Allah. In fact, Islam has set up some conditions to ensure achieving the purpose for which the bequest was made. One of them is fulfilling the condition made by the deceased because he must have made it for a purpose that none knows but he.
Accordingly, the bequest mentioned in the above question is valid and should be executed where the specified amount should be given to the beneficiaries in question.
"If he bequeathed that ten dinars be given every month to a certain person, some of the Hanafii scholars said: "One third of the estate should be deducted to give from. However, if the beneficiary passed away and some money remained from that third, then it should be returned to the heirs. Moreover, if that third was lost or destroyed for some reason before giving any of it to that beneficiary then the latter gets nothing."{Al-Notaf Fi Al-Fatawa by Al-Sa`ghdi, 2/826}. In addition, "Al-Abhari said: "If he made a bequest that a certain amount should be spent on a certain person over a period of ten years then that amount should be deducted from his estate to give from."{Al-Thakhirah by Al-Kharafii, 7/37}. And Allah knows best.