All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
What we understood from the question is that the father of this family whom you named G rented a flat and lived in it for a period of time along with the other members of his family, as well as the family of one of his sons whom you named D. Then the father departed from this accommodation to another one and left it for his son D who lived there together with the other members of the family. Thereupon the members of the family succeeded in dying according to the order that you mentioned in the question. However, the wife of son D and her daughter as well as her son in-law still live in the flat.
Now, you are inquiring whether or not the sons who are still alive and the wife of the deceased son have the right in renting the flat which is still in the name of the father. Our answer is that the rent is one of the contracts which both parties are bound to abide by until the end of the contract period, and one party cannot breach the contract except with the agreement of the other party if there is any period that is agreed upon between them. However, if the rent period is not defined then that is what is known in Arabic by 'Almushaaharah', which means that the rent period is not defined and both parties can terminate the tenancy agreement at any given time. The majority of the scholars are of the view that this kind of agreement is permissible while some others are of the view that it is not valid. Even according to the opinion which says that this kind of contract is permissible, both parties can terminate the contract whenever they wish. Ad-Dardeer [from the Maaliki school] said: 'It is permissible to initiate a rent agreement without defining the rent period'. [Almushaaharah] The jurists mean by this term what is expressed as 'Every month you have to pay such a given amount' or 'Every day' or 'every Friday' or 'every year'; none of the parties is obliged to abide by the contract and any of them can terminate it whenever they wish.'
Anyway, when the rent period is not finished or none of the parties expressed his will to terminate the tenancy, then the agreement is still valid and it is not invalidated by the death of any of the parties, but the right of the deceased will be transferred to his heirs like any other inheritance of his.
Therefore, the right of rent is for all the heirs of G, whether they are alive or dead. The right of the people who are still alive will be given to them, and the right of the deceased will be given to their heirs.
So the inheritance of the deceased will be divided as follows:
1- The inheritance of the person named G:
His wife will get one-eighth share of the inheritance as there are other heirs [children]. Allaah Says (which means): {But if you leave a child, then for them [i.e. the wives] is an eighth of what you leave.}[Quran 4:12].
The remaining share will be divided among the father's sons and daughter; the male's portion is twice as much as the female's, Allaah Says (which means): {Allaah instructs you concerning your children [i.e. their portions of inheritance]: for the male, what is equal to the share of two females.}[Quran 4:11].
2- The inheritance of the wife H:
Her inheritance will be divided among her children and her daughter, the male's portion is twice as much as the female's.
3- The inheritance of the daughter Z:
Her inheritance will be divided equally between her four brothers.
4- The inheritance of the son D:
His wife will get one-eighth share of the inheritance because there are other heirs [children]. His daughter will get half of the share, as Allaah Says (which means): {And if there is only one [daughter], for her is half.}[Quran 4:11]. The remainder will be divided among his three brothers, as the Prophet said: "Give the prescribed share of inheritance to those who are liable for it and the remainder [of it] is for the nearest male relative." [Al-Bukhari and Muslim]
Finally, we say that your question is not clear, so if we understood your question properly, then all perfect praise be to Allaah, otherwise we request you to clarify it for us.
Allaah Knows best.