§ After mentioning the spirit named kordeyakos on the previous daf the Gemara relates other matters connected to spirits and demons. It is written: “I got myself sharim and sharot, and human pleasures, shidda and shiddot” (Ecclesiastes 2:8). The Gemara explains: “Sharim and sharot”: These are types of musical instruments. “And human pleasures”: These are pools and bathhouses. “Shidda and shiddot”: Here, in Babylonia, they interpreted these words in the following manner: Male demons [shidda] and female demons [shiddetin]. In the West, Eretz Yisrael, they said that these words are referring to carriages [shiddeta]. Rabbi Yoḥanan says: There were three hundred types of demons in a place named Shiḥin, but I do not know what the form or nature of a demon itself is. The Master said: Here they interpreted it: Male demons and female demons. The Gemara asks: Why was it necessary for Solomon, the author of Ecclesiastes, to have male demons and female demons? The Gemara answers: As it is written with regard to the building of the Temple: “For the house, when it was being built, was built of stone made ready at the quarry; and there was neither hammer nor axe nor any tool of iron heard in the house, while it was being built” (I Kings 6:7). Solomon said to the sages: How shall I make it so that the stone will be precisely cut without using iron? They said to him: There is a creature called a shamir that can cut the stones, which Moses brought and used to cut the stones of the ephod. Solomon said to them: Where is it found? They said to him: Bring a male demon and a female demon and torment them together. It is possible that they know where, and due to the suffering they will reveal the place to you. Solomon brought a male demon and a female demon and tormented them together, and they said: We do not know where to find the shamir. Perhaps Ashmedai, king of the demons, knows. Solomon said to them: Where is Ashmedai? They said to him: He is on such-and-such a mountain. He has dug a pit for himself there, and filled it with water, and covered it with a rock, and sealed it with his seal. And every day he ascends to Heaven and studies in the heavenly study hall and he descends to the earth and studies in the earthly study hall. And he comes and checks his seal to ensure that nobody has entered his pit, and then he uncovers it and drinks from the water in the pit. And then he covers it and seals it again and goes. Solomon sent for Benayahu, son of Jehoiada, a member of the royal entourage, and gave him a chain onto which a sacred name of God was carved, and a ring onto which a sacred name of God was carved, and fleeces of wool and wineskins of wine. What did Benayahu do? He went and dug a pit lower down the mountain, below the pit dug by Ashmedai, drained the water, and plugged it with the fleeces of wool so that Ashmedai’s pit was emptied. And he dug a pit higher up the mountain, above Ashmedai’s pit. And he poured the wine into it so that the wine filled Ashmedai’s pit, and he plugged the lower and upper pits that he dug. He climbed up and sat in a tree. When Ashmedai came he checked his seal, opened the pit, and found it to be filled with wine. He said that it is written: “Wine is a mocker, strong drink is riotous; and whosoever wallows in it is not wise” (Proverbs 20:1), and it is written: “Harlotry, wine, and new wine take away the heart” (Hosea 4:11). He concluded: I will not drink this wine. Eventually, when he became thirsty, he was unable to resist the wine and he drank, became intoxicated, and fell asleep. Benayahu descended from the tree, came, and threw the chain around Ashmedai, and enclosed him within it. When Ashmedai awoke he struggled to remove the chain. Benayahu said to him: The name of your Master is upon you, the name of your Master is upon you, do not tear the chain. God’s name is written on this chain, and it is forbidden to destroy it. When Benayahu took Ashmedai and came to Jerusalem he reached a palm tree and Ashmedai rubbed against it and knocked it down. He reached a house and knocked it down. He reached a small shack [kuva] belonging to a certain widow. This widow emerged, and she begged him not to knock down the house. He bent his body away from her, to the other side, and broke one of his bones. He said: This is as it is written: “Soft speech can break a bone” (Proverbs 25:15). Ashmedai saw a blind man who was lost on the road and he brought him to the correct road. He saw a drunk who was lost on the road and he brought him to the correct road. He saw the joy of a wedding celebration in which they were celebrating, and he cried. He heard a certain man say to a shoemaker [ushkafa]: Make me shoes that will last for seven years, and he laughed. He saw a certain sorcerer performing magic, and he laughed. When Ashmedai arrived there, in Jerusalem, they did not bring him before Solomon until three days had passed. On the first day he said to them: Why doesn’t the king want me to come to him? They said to him: He drank too much and was overcome by drink. Ashmedai took a brick and placed it on top of another brick. The servants came and told Solomon what he had done. Solomon interpreted the action and said to them: This is what he said to you through this allusion: Return and give the king more to drink. The following day Ashmedai said to them: And why doesn’t the king want me to come to him? They said to him: He ate too much and was overcome by food. Ashmedai took the brick off the other brick and placed it on the ground. The servants came and told Solomon what Ashmedai had done. He interpreted Ashmedai’s actions and said to them: This is what he said to you through this allusion: Take his food away from him. At the end of three days Ashmedai came before Solomon. Ashmedai took a reed and measured four cubits [garmidei], and threw it before him. He said to Solomon: See, when that man, Solomon, dies, he will have nothing in this world except the four cubits of his grave. Now you have conquered the entire world and yet you are not satisfied until you also conquer me? Solomon said to him: I need nothing from you. I want to build the Temple and I need the shamir for this. Ashmedai said to him: The shamir was not given to me, but it was given to the angelic minister of the sea. And he gives it only to the wild rooster, also known as the dukhifat or the hoopoe, whom he trusts by the force of his oath to return it. And what does the wild rooster do with it? He brings it to mountains that are not fit for habitation, and he places the shamir on the craggy rock and the mountain splits. And he takes and brings seeds of trees, throws them there, and it becomes fit for habitation. And this is why we interpret the word dukhifat as a cutter of mountains [naggar tura], i.e., the Aramaic translation of the word dukhifat in the Bible is naggar tura, cutter of mountains. They investigated and found the nest of a wild rooster in which there were chicks, and he covered its nest with translucent glass. When the rooster came it wanted to enter the nest but was unable to do so. It went and brought the shamir and placed it on top to crack the glass. Solomon’s servant threw a clump of dirt at the rooster and the rooster knocked over the shamir. The man took it and the wild rooster went and strangled itself over the fact that it had not kept its oath, by not returning the shamir. Later, Benayahu said to Ashmedai: What is the reason that when you saw that blind man who was lost on the road you brought him to the correct road? Ashmedai said to him: They proclaim about him in heaven that he is a completely righteous man, and anyone who does good for his soul shall merit to enter the World-to-Come. Then Benayahu asked: And what is the reason that when you saw the drunk man who was lost on the road you brought him to the correct road? Ashmedai said to him: They proclaim about him in heaven that he is a completely wicked man. And I did good for his soul so that he will consume his reward in this world and not have any reward in the World-to-Come. Benayahu continued and asked him: What is the reason that when you saw that joy of the wedding you cried? Ashmedai said to him: I knew that this man will die within thirty days. And his wife is required to wait for the yavam, the husband’s brother, who is a minor, to reach the age of thirteen years, the age of majority, so that he can release her through ḥalitza, the ritual through which the yavam frees the yevama of her levirate bonds. In addition, he asked: What is the reason that when you heard that man say to a shoemaker: Make me shoes that will last for seven years, you laughed? Ashmedai said to him: That man does not have seven days to live; does he need shoes that will last for seven years? Benayahu then asked: What is the reason that when you saw that sorcerer performing magic you laughed? Ashmedai said to him: Because he was sitting on the king’s treasury [bei gaza]. Let him use his magic to know what there is buried underneath him. Solomon kept Ashmedai with him until he completed building the Temple. One day he stood with Ashmedai alone. He said to Ashmedai: It is written: “For him like the lofty horns of the wild ox” (Numbers 24:8), and the Sages say in explanation of the verse: “Like the lofty horns”; these are the ministering angels. “The wild ox”; these are the demons. In what way are you greater than us? Why does the verse praise your abilities and powers over those of human beings? Ashmedai said to him: Take the chain engraved with God’s name off me and give me your ring with God’s name engraved on it, and I will show you my strength. Solomon took the chain off him and he gave him his ring. Ashmedai swallowed the ring and grew until he placed one wing in the heaven and one wing on the earth. He threw Solomon a distance of four hundred parasangs. With regard to that moment Solomon said: “What profit is there for a person through all of his toil under the sun?” (Ecclesiastes 1:3). With Solomon deposed from the throne, Ashmedai took his place. With regard to the verse: “And this was my portion from all of my toil” (Ecclesiastes 2:10), the Gemara asks: What is the meaning of the expression: “And this”? This expression is always an allusion to an item that is actually in his hand or can be shown. Rav and Shmuel disagree with regard to the meaning of this phrase. One said: This is referring to Solomon’s staff that remained in his hand. And one said: This is referring to his cloak. Solomon circulated from door to door collecting charity, and wherever he arrived he would say: “I, Ecclesiastes, was king over Israel in Jerusalem” (Ecclesiastes 1:12). When he finally arrived at the Sanhedrin in Jerusalem the sages said: Now, an imbecile does not fixate on one matter all of the time, so what is this matter? Is this man perhaps telling the truth that he is Solomon? The sages said to Benayahu: Does the king require you to be with him? Benayahu said to them: No. They sent to the queens and asked: Does the king come to be with you? The queens sent a response to them: Yes, he comes. They sent a request to the queens: Check his feet to see if they are human feet. The queens sent a response to the sages: He always comes in socks [bemokei], and it is not possible to see his feet. The queens continued discussing the king’s behavior: And he demands of them, i.e., the queens, to engage in sexual inter-course when they are menstruating. And he also demands that Bathsheba his mother engage in sexual intercourse with him. Once the Sanhedrin heard this they understood that this was an imposter and not actually Solomon. They brought Solomon, gave him a ring and the chain on which the name of God was carved. When Solomon entered, Ashmedai saw him and fled. The Gemara adds: And even so, although Ashmedai fled, Solomon was fearful of him, and this is as it is written: “Behold the bed of Solomon surrounded by sixty strong men from the warriors of Israel. All of them holding swords and trained in war, each man with his sword on his thigh from fear in the nights” (Song of Songs 3:7–8). Rav and Shmuel disagreed with regard to this story of Solomon. One said: He was a king and afterward he became a commoner, and never returned to his position as king. And one said: He was a king, and became a commoner, and a king, as ultimately he returned to his throne and defeated Ashmedai.