Hardship 401k penalty

I’m doing my 2023 returns and I took out of 401 k my father in law and dad were sick. Father in law passed 2023 and my dad 2024. I missed work had to pay mortgage , kids tuition and other things.