such as Shunten and Eiso, were important rulers. An attempted Mongolian invasion in 1291 during the Eiso Dynasty failed. Hiragana was imported from Japan by Ganjin in 1265. Noro, village priestesses of the Ryukyuan religion, appeared. Sanzan era and Ryūkyū Kingdom The Sanzan period began in 1314 when the kingdoms of Hokuzan and Nanzan declared independence from Chūzan. The three kingdoms competed with one another for recognition and trade with Ming China. King Satto, leading Chūzan, was very successful, establishing relations with Korea and Southeast Asia as well as China. The Hongwu Emperor sent 36 families from Fujian in 1392 at the request of the Ryukyuan king. Their job was to manage maritime dealings in the kingdom. They assisted the Ryukyuans in developing their technology and diplomatic relations. In 1407, however, a man named Hashi overthrew Satto's descendant, King Bunei, and installed his father, Shishō, as king of Chūzan. In 1429, King Shō Hashi completed the unification of the three kingdoms and founded the Ryūkyū Kingdom with its capital at Shuri Castle. His descendants conquered the Amami Islands. In 1469, King Shō Taikyū died, so the royal government chose a man named Kanemaru as the new king, who chose the name Shō En and established the Second Shō Dynasty. His son Shō Shin conquered the Sakishima Islands and centralized the royal government, the military, and the noro priestesses. Satsuma domain In 1609, the Japanese domain of Satsuma launched an invasion of the Ryukyu Kingdom, ultimately capturing the king and his capital after a long struggle. Ryukyu was forced to cede the Amami Islands and become a vassal of Satsuma. The kingdom became both a tributary of China and a tributary of Japan. Because China would not make a formal trade agreement unless a country was a tributary state, the kingdom was a convenient loophole for Japanese trade with China. When Japan officially closed off trade with European nations except for the Dutch, Nagasaki, Tsushima, and Kagoshima became the only Japanese trading ports offering connections with the outside world. At some time, karate came into its existence as a type of systemised martial arts. 18-19th century Several Europeans visited Ryukyu starting in the late 18th century. The most important visits to Okinawa were from Captain Basil Hall in 1816 and Commodore Matthew C. Perry in 1852. A Christian missionary, Bernard Jean Bettelheim, lived in the Gokoku-ji temple in Naha from 1846