Bhagavad Gita 8.6

Yam yam vapi smaran bhavam tyajaty ante kalevaram, tam tam evaiti (Gita 8.6)

Whatever thought you have in your mind at the moment of death, at the time of death, that will materialise itself and will be extracted and exported out of your impressions, like ghee is churned from milk.

Knowing this truth, someone will want to make use of this by scheming that at the very last moment, I will entertain a prosperous thought so now I can think and do whatever I like. This scheming will be last thought that you will have. The last thought is the fruit from which you have produced from the tree of the life throughout your current life.  You will not be able to get a mango from a rambutan tree. You cannot have one kind of tree and another kind of fruit.