Genesis 39:20

39:20 Joseph’s master took him and threw him into the prison, the place where the king’s prisoners were confined. So he was there in the prison.

Genesis 40:2-3

40:2 Pharaoh was enraged with his two officials, the cupbearer and the baker, 40:3 so he imprisoned them in the house of the captain of the guard in the same facility where Joseph was confined.