The gwageo or kwago were the national civil service examinations under the Goryeo and Joseon dynasties of Korea. Typically quite demanding, these tests measured candidates' ability of writing composition and knowledge of the Chinese classics. The form of writing varied from literature to proposals on management of the state. Technical subjects were also tested to appoint experts on medicine, interpretation, accounting, law etc. These were the primary route for most people to achieve positions in the bureaucracy. Based on the civil service examinations of imperial China, the gwageo first arose in Unified Silla, gained importance in Goryeo, and were the centerpiece of most education in the Joseon dynasty. The tutelage provided at the hyanggyo, seowon, and Sungkyunkwan was aimed primarily at preparing students for the gwageo and their subsequent career in government service. Under Joseon law, high office was closed to those who were not children of officials of the second full rank or higher, unless the candidate had passed the gwageo. Those who passed the higher literary examination came to monopolize all of the dynasty's high positions of state. Silla The first national examinations were administered in the kingdom of Silla beginning in 788, after the Confucian scholar Choe Chiwon submitted the Ten Urgent Points of Reform to Queen Jinseong, the ruler of Silla at the time. However, due to Silla's entrenched bone rank system, which dictated that appointments be made on the basis of birth, these examinations did not have a strong effect on the government. Goryeo Under the Goryeo dynasty, the national examinations became more systematic and powerful than they had been under Silla. However, they remained only one among several avenues to power. A man who had reached a position of the fifth rank or higher could automatically have one son placed in a position of rank. The examinations were established in 958, during the reign of Gwangjong as a means of breaking the hold which a few powerful families held over the government. Throughout the dynasty, they retained this character of strengthening the throne against the aristocracy. This also took the form of aligning the throne with the provincial elites, and the kings of Goryeo strove to extend educational opportunities to the local elites throughout the country. In fact, any member of the yangin freeborn class was permitted to take the examination, although the descendants of monks, criminals and cheonmin were excluded. However, over time