This is based on a proverb, "Rika no Kanmuri, Kaden no Kutsu" (literally, lifting a courtier's cap under the plum tree, and stepping into the gourd field, which is a Chinese counterpart of "Be careful not to invite the least suspicion"), which is also included in the Chinese book "Monzen" (ancient Chinese poems).
これは中国の書物『文選(書物)』にもある諺「李下の冠、瓜田の履」に由来するものである。