Srimad Bhagavatam Canto 05, Chapter 26, Text 37

SB 5.26.37

evam-vidha naraka yamalaye santi satasah sahasrasas tesu sarvesu ca sarva evadharma-vartino ye kecid
ihodita anuditas cavani-pate paryayena visanti tathaiva dharmanuvartina itaratra iha tu punar-bhave ta
ubhaya-sesabhyam nivisanti.
Translation by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
My dear King Pariksit, in the province of Yamaraja there are hundreds and thousands of hellish planets. The impious people I have mentioned — and also those I have not mentioned — must all enter these various planets according to the degree of their impiety. Those who are pious, however, enter other planetary systems, namely the planets of the demigods. Nevertheless, both the pious and impious are again brought to earth after the results of their pious or impious acts are exhausted.
Purport by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
This corresponds to the beginning of Lord Krsna’s instructions in Bhagavad-gita. Tatha dehantara-praptih: within this material world, one is simply meant to change from one body to another in different planetary systems. Urdhvam gacchanti sattva-stha: those in the mode of goodness are elevated to the heavenly planets. Adho gacchanti tamasah: similarly, those too engrossed in ignorance enter the hellish planetary systems. Both of them, however, are subjected to the repetition of birth and death. In Bhagavad-gita it is stated that even one who is very pious returns to earth after his enjoyment in the higher planetary systems is over (ksine punye martya-lokam visanti). Therefore, going from one planet to another does not solve the problems of life. The problems of life will only be solved when we no longer have to accept a material body. This can be possible if one simply becomes Krsna conscious. As Krsna says in Bhagavad-gita (4.9):
janma karma ca me divyam
 evam yo vetti tattvatah
tyaktva deham punar janma
 naiti mam eti so ’rjuna
“One who knows the transcendental nature of My appearance and activities does not, upon leaving the body, take his birth again in this material world, but attains My eternal abode, O Arjuna.” This is the perfection of life and the real solution to life’s problems. We should not be eager to go to the higher, heavenly planetary systems, nor should we act in such a way that we have to go to the hellish planets. The complete purpose of this material world will be fulfilled when we resume our spiritual identities and go back home, back to Godhead. The very simple method for doing this is prescribed by the Supreme Personality of Godhead. Sarva-dharman parityajya mam ekam saranam vraja. One should be neither pious nor impious. One should be a devotee and surrender to the lotus feet of Krsna. This surrendering process is also very easy. Even a child can perform it. Man-mana bhava mad-bhakto mad-yaji mam namaskuru. One must always simply think of Krsna by chanting Hare Krsna, Hare Krsna, Krsna Krsna, Hare Hare/ Hare Rama, Hare Rama, Rama Rama, Hare Hare. One should become Krsna’s devotee, worship Him and offer obeisances to Him. Thus one should engage all the activities of his life in the service of Lord Krsna.
Srimad Bhagavatam Canto 05, Chapter 26, Text 36
Srimad Bhagavatam Canto 05, Chapter 26, Text 38