Japan has always been a place where the visible and the invisible coexist, and though August is the traditional period here when the worlds of the living and the dead overlap, who’s to say spirits don’t make an exception when Halloween rolls around — especially in a city with as long and grisly a history as Kyoto?

One such vengeful spirit long associated with the city is Sugawara no Michizane, a scholar and politician in the mid-Heian Period (794-1185). After a conflict with the powerful Fujiwara clan got him banished to Kyushu in 901, Sugawara died there two years later. Across the country, it was said that plague and drought quickly followed, and to appease his spirit, Sugawara was deified as Tenjin, originally a kami (god) of sky and storms but since repackaged into the more benevolent kami of scholarship.

The principal shrine dedicated to this kami is Kyoto’s Kitano Tenmangu, which oversees 12,000 smaller affiliate shrines nationwide, at which students can often be seen in prayer. Kitano Tenmangu also hosts a lively flea market the 25th of every month — if you’re looking to placate this spirit once more with a timely Halloween purchase.