Question: In what year did Japan finish invading the country where Ofusato died?

full_context: Document 1: Samurai: Despite the rampant romanticism of the 20th century, samurai could be disloyal and treacherous (e.g., Akechi Mitsuhide), cowardly, brave, or overly loyal (e.g., Kusunoki Masashige). Samurai were usually loyal to their immediate superiors, who in turn allied themselves with higher lords. These loyalties to the higher lords often shifted; for example, the high lords allied under Toyotomi Hideyoshi (豊臣秀吉) were served by loyal samurai, but the feudal lords under them could shift their support to Tokugawa, taking their samurai with them. There were, however, also notable instances where samurai would be disloyal to their lord or daimyo, when loyalty to the Emperor was seen to have supremacy.
Document 2: Sino-Tibetan relations during the Ming dynasty: Wang and Nyima argue that the Ming emperor sent edicts to Tibet twice in the second year of the Ming dynasty, and demonstrated that he viewed Tibet as a significant region to pacify by urging various Tibetan tribes to submit to the authority of the Ming court. They note that at the same time, the Mongol Prince Punala, who had inherited his position as ruler of areas of Tibet, went to Nanjing in 1371 to pay tribute and show his allegiance to the Ming court, bringing with him the seal of authority issued by the Yuan court. They also state that since successors of lamas granted the title of "prince" had to travel to the Ming court to renew this title, and since lamas called themselves princes, the Ming court therefore had "full sovereignty over Tibet." They state that the Ming dynasty, by issuing imperial edicts to invite ex-Yuan officials to the court for official positions in the early years of its founding, won submission from ex-Yuan religious and administrative leaders in the Tibetan areas, and thereby incorporated Tibetan areas into the rule of the Ming court. Thus, they conclude, the Ming court won the power to rule Tibetan areas formerly under the rule of the Yuan dynasty.
Document 3: Samurai: In the 13th century, Hōjō Shigetoki (1198–1261 AD) wrote: "When one is serving officially or in the master's court, he should not think of a hundred or a thousand people, but should consider only the importance of the master." Carl Steenstrup noted that 13th and 14th century warrior writings (gunki) "portrayed the bushi in their natural element, war, eulogizing such virtues as reckless bravery, fierce family pride, and selfless, at times senseless devotion of master and man". Feudal lords such as Shiba Yoshimasa (1350–1410 AD) stated that a warrior looked forward to a glorious death in the service of a military leader or the Emperor: "It is a matter of regret to let the moment when one should die pass by....First, a man whose profession is the use of arms should think and then act upon not only his own fame, but also that of his descendants. He should not scandalize his name forever by holding his one and only life too dear....One's main purpose in throwing away his life is to do so either for the sake of the Emperor or in some great undertaking of a military general. It is that exactly that will be the great fame of one's descendants."
Document 4: Yuan dynasty: When Yesün Temür died in Shangdu in 1328, Tugh Temür was recalled to Khanbaliq by the Qipchaq commander El Temür. He was installed as the emperor (Emperor Wenzong) in Khanbaliq, while Yesün Temür's son Ragibagh succeeded to the throne in Shangdu with the support of Yesün Temür's favorite retainer Dawlat Shah. Gaining support from princes and officers in Northern China and some other parts of the dynasty, Khanbaliq-based Tugh Temür eventually won the civil war against Ragibagh known as the War of the Two Capitals. Afterwards, Tugh Temür abdicated in favour of his brother Kusala, who was backed by Chagatai Khan Eljigidey, and announced Khanbaliq's intent to welcome him. However, Kusala suddenly died only four days after a banquet with Tugh Temür. He was supposedly killed with poison by El Temür, and Tugh Temür then remounted the throne. Tugh Temür also managed to send delegates to the western Mongol khanates such as Golden Horde and Ilkhanate to be accepted as the suzerain of Mongol world. However, he was mainly a puppet of the powerful official El Temür during his latter three-year reign. El Temür purged pro-Kusala officials and brought power to warlords, whose despotic rule clearly marked the decline of the dynasty.
Document 5: Sino-Tibetan relations during the Ming dynasty: Sonam Gyatso, after being granted the grandiose title by Altan Khan, departed for Tibet. Before he left, he sent a letter and gifts to the Ming Chinese official Zhang Juzheng (1525–1582), which arrived on March 12, 1579. Sometime in August or September of that year, Sonam Gyatso's representative stationed with Altan Khan received a return letter and gift from the Wanli Emperor (r. 1572–1620), who also conferred upon Sonam Gyatso a title; this was the first official contact between a Dalai Lama and a government of China. However, Laird states that when Wanli invited him to Beijing, the Dalai Lama declined the offer due to a prior commitment, even though he was only 400 km (250 mi) from Beijing. Laird adds that "the power of the Ming emperor did not reach very far at the time." Although not recorded in any official Chinese records, Sonam Gyatso's biography states that Wanli again conferred titles on Sonam Gyatso in 1588, and invited him to Beijing for a second time, but Sonam Gyatso was unable to visit China as he died the same year in Mongolia working with Altan Khan's son to further the spread of Buddhism.
Document 6: Samurai: Katō Kiyomasa was one of the most powerful and well-known lords of the Sengoku Era. He commanded most of Japan's major clans during the invasion of Korea (1592–1598). In a handbook he addressed to "all samurai, regardless of rank" he told his followers that a warrior's only duty in life was to "...grasp the long and the short swords and to die". He also ordered his followers to put forth great effort in studying the military classics, especially those related to loyalty and filial piety. He is best known for his quote: "If a man does not investigate into the matter of Bushido daily, it will be difficult for him to die a brave and manly death. Thus it is essential to engrave this business of the warrior into one's mind well."
Document 7: Nanjing: As the center of the empire, early-Ming Nanjing had worldwide connections. It was home of the admiral Zheng He, who went to sail the Pacific and Indian Oceans, and it was visited by foreign dignitaries, such as a king from Borneo (Boni 渤泥), who died during his visit to China in 1408. The Tomb of the King of Boni, with a spirit way and a tortoise stele, was discovered in Yuhuatai District (south of the walled city) in 1958, and has been restored.
Document 8: Samurai: The philosophies of Buddhism and Zen, and to a lesser extent Confucianism and Shinto, influenced the samurai culture. Zen meditation became an important teaching due to it offering a process to calm one's mind. The Buddhist concept of reincarnation and rebirth led samurai to abandon torture and needless killing, while some samurai even gave up violence altogether and became Buddhist monks after realizing how fruitless their killings were. Some were killed as they came to terms with these realizations in the battlefield. The most defining role that Confucianism played in samurai philosophy was to stress the importance of the lord-retainer relationship—the loyalty that a samurai was required to show his lord.
Document 9: Bruneian Empire: After the death of its emperor, Hayam Wuruk, Majapahit entered a state of decline and was unable to control its overseas possessions. This opened the opportunity for Bruneian kings to expand their influence. Chinese Ming emperor Yongle, after ascending to the throne in 1403, immediately dispatched envoys to various countries, inviting them to pay tribute to the Chinese court. Brunei immediately got involved in the lucrative tributary system with China.
Document 10: Samurai: Bushi was the name given to the ancient Japanese soldiers from traditional warrior families. The bushi class was developed mainly in the north of Japan. They formed powerful clans, which in the 12th century were against the noble families who were grouping themselves to support the imperial family who lived in Kyoto. Samurai was a word used by the Kuge aristocratic class with warriors themselves preferring the word bushi. The term Bushidō, the "way of the warrior", is derived from this term and the mansion of a warrior was called bukeyashiki.
Document 11: Yuan dynasty: When the Mongols placed the Uighurs of the Kingdom of Qocho over the Koreans at the court the Korean King objected, then the Mongol Emperor Kublai Khan rebuked the Korean King, saying that the Uighur King of Qocho was ranked higher than the Karluk Kara-Khanid ruler, who in turn was ranked higher than the Korean King, who was ranked last, because the Uighurs surrendered to the Mongols first, the Karluks surrendered after the Uighurs, and the Koreans surrendered last, and that the Uighurs surrendered peacefully without violently resisting.
Document 12: Samurai: Historian H. Paul Varley notes the description of Japan given by Jesuit leader St. Francis Xavier (1506–1552): "There is no nation in the world which fears death less." Xavier further describes the honour and manners of the people: "I fancy that there are no people in the world more punctilious about their honour than the Japanese, for they will not put up with a single insult or even a word spoken in anger." Xavier spent the years 1549–1551 converting Japanese to Christianity. He also observed: "The Japanese are much braver and more warlike than the people of China, Korea, Ternate and all of the other nations around the Philippines."
Document 13: Samurai: Torii Mototada (1539–1600) was a feudal lord in the service of Tokugawa Ieyasu. On the eve of the battle of Sekigahara, he volunteered to remain behind in the doomed Fushimi Castle while his lord advanced to the east. Torii and Tokugawa both agreed that the castle was indefensible. In an act of loyalty to his lord, Torii chose to remain behind, pledging that he and his men would fight to the finish. As was custom, Torii vowed that he would not be taken alive. In a dramatic last stand, the garrison of 2,000 men held out against overwhelming odds for ten days against the massive army of Ishida Mitsunari's 40,000 warriors. In a moving last statement to his son Tadamasa, he wrote:
Document 14: Samurai: It should be noted that many samurai forces that were active throughout this period were not deployed to Korea; most importantly, the daimyo Tokugawa Ieyasu carefully kept forces under his command out of the Korean campaigns, and other samurai commanders who were opposed to Hideyoshi's domination of Japan either mulled Hideyoshi's call to invade Korea or contributed a small token force. Most commanders who did opposed or otherwise resisted/resented Hideyoshi ended up as part of the so-called Eastern Army, while commanders loyal to Hideyoshi and his son (a notable exception to this trend was Katō Kiyomasa, who deployed with Tokugawa and the Eastern Army) were largely committed to the Western Army; the two opposing sides (so named for the relative geographical locations of their respective commanders' domains) would later clash, most notably at the Battle of Sekigahara, which was won by Tokugawa Ieyasu and the Eastern Forces, paving the way for the establishment of the Tokugawa Shogunate.
Document 15: Ofusato: He presented himself to the Chinese imperial court for recognition in 1388. After Ofusato died while in Korea, his brother Yafuso seized power and sought formal recognition from China.
ground_truth: 1598
sub_queries: In what place did Ofusato die? Answer: Korea
When did Japan finish invading Korea ? Answer: 1598