GenesisChapter 40

Some time later, the cupbearer and the baker of the king of Egypt offended their master, the king of Egypt.
and he put them in custody in the house of the captain of the guard, in the prison where Joseph was confined.
The captain of the guard assigned Joseph to them, and Joseph attended them. They remained in custody for some time.
One night both of them—the cupbearer and the baker of the king of Egypt, who were being held in the prison—had a dream, each his own dream, and each dream had its own meaning.
When Joseph came to them in the morning, he saw that they were troubled.
So he asked Pharaoh's officials, who were with him in custody in his master's house, "Why do you look so downcast today?"
They said to him, "We each had a dream, and there is no one to interpret it." Joseph said to them, "Do not interpretations belong to God? Tell me your dreams."
So the chief cupbearer told Joseph his dream: "In my dream there was a vine before me,
and on the vine were three branches. It had barely budded when its blossoms opened and its clusters ripened into grapes.
Pharaoh's cup was in my hand, and I took the grapes and pressed them into Pharaoh's cup and placed the cup in Pharaoh's hand."
Joseph said to him, "This is what it means: the three branches are three days.
Within three days Pharaoh will lift up your head and restore you to your position, and you will place the cup in Pharaoh's hand, just as you did before, when you were his cupbearer.
But remember me when things go well for you, and show me kindness: mention me to Pharaoh and get me out of this house.
For I was carried off by force from the land of the Hebrews, and here too I have done nothing to deserve being put in this pit."
When the chief baker saw that the interpretation was favorable, he said to Joseph, "I too had a dream: there were three baskets of bread on my head.
In the top basket were all sorts of baked goods for Pharaoh, and the birds were eating them out of the basket on my head."
Joseph answered, "This is what it means: the three baskets are three days.
Within three days Pharaoh will lift up your head—from off your body—and hang you on a tree, and the birds will eat the flesh from your body.
Three days later it was Pharaoh's birthday, and he gave a banquet for all his servants. In the presence of his servants he lifted up the head of the chief cupbearer and the head of the chief baker:
he restored the chief cupbearer to his office, so that he once again placed the cup in Pharaoh's hand,
but he hanged the chief baker—just as Joseph had told them.
The chief cupbearer, however, did not remember Joseph; he forgot him.