Exodus 20:5
You must not worship or serve any idol, because I, the Lord your God, am a jealous God. If you hate me, I will punish your children, and even your grandchildren and great-grandchildren.
Idolatry's punishment reaches grandchildren of those who hate God.
Exodus 34:7ben
and is kind to thousands of people. The Lord forgives people for evil, for sin, and for turning against him, but he does not forget to punish guilty people. He will punish not only the guilty people, but also their children, their grandchildren, their great-grandchildren, and their great-great-grandchildren."