The origin of sake is unclear. The earliest reference to the use of alcohol in Japan is recorded in the "Book of Wei" in the "Records of the Three Kingdoms". This 3rd-century Chinese text speaks of the Japanese drinking and dancing. Alcoholic beverages () are mentioned several times in the "Kojiki", Japan's first written history, which was compiled in 712. Bamforth (2005) places the probable origin of true sake (which is made from rice, water, and "kōji" mold (, "Aspergillus oryzae") in the Nara period (710–794). In the Heian period, sake was used for religious ceremonies, court festivals, and drinking games. Sake production was a government monopoly for a long time, but in the 10th century, temples and shrines began to brew sake, and they became the main centers of production for the next 500 years. The "Tamon-in Diary", written by abbots of Tamon-in (temple) from 1478 to 1618, records many details of brewing in the temple. The diary shows that pasteurization and the process of adding ingredients to the main fermentation mash in three stages were established practices by that time. In the 16th century, the technique of distillation was introduced into the Kyushu district from Ryukyu. The brewing of shōchū, called "Imo–sake" started, and was sold at the central market in Kyoto.