The first to settle in Korea were nomads from northeast Asia. They began to make clans and develop a culture until being defeated by the Han dynasty. After this defeat Chinese culture took over in Korea such as Confucianism, writing, government, and Buddhism. Once the Han dynasty fell, three kingdoms took control of Korea. In 668, the Sillas decided to side with China to overthrow the other two kingdoms. After the two kingdoms were defeated the Sillas turned on China and drove them out of Korea. The Sillas were in control of all of Korea by 670. In about 935, the Sillas had weakened and were overthrown by rebels. These rebels then founded the Koryo Dynasty, which lasted until 1392. During the Koryo dynasty there was still Chinese influence, however, there were also great differences. In Korea, only nobles could take civil service exams and government positions were inherited. During the 1200's the Yuan mongols invaded Korea. Rulers were forced to pay immense tributes and many Koreans were taken as slaves. Following the fall of the Yuan dynasty, a Korean general started a new dynasty which lasted until 1910.