Question: Who was president when the state to the north of Missouri joined the U.S.A.?

full_context: Document 1: Des Moines, Iowa: On September 22, 1851, Des Moines was incorporated as a city; the charter was approved by voters on October 18. In 1857, the name ``Fort Des Moines ''was shortened to`` Des Moines'', and it was designated as the second state capital, previously at Iowa City. Growth was slow during the Civil War period, but the city exploded in size and importance after a railroad link was completed in 1866.
Document 2: History of Texas (1845–1860): The Republic of Texas had formed in 1836, after breaking away from Mexico in the Texas Revolution. The following year, an ambassador from Texas approached the United States about the possibility of becoming an American state. Fearing a war with Mexico, which did not recognize Texas independence, the United States declined the offer. In 1844, James K. Polk was elected the United States president after promising to annex Texas. Before he assumed office, the outgoing president, John Tyler, entered negotiations with Texas. On February 26, 1845, six days before Polk took office, the U.S. Congress approved the annexation. The Texas legislature approved annexation in July 1845 and constructed a state constitution. In October, Texas residents approved the annexation and the new constitution, and Texas was officially inducted into the United States on December 29, 1845.
Document 3: Tennessee: Tennessee (i/tɛnᵻˈsiː/) (Cherokee: ᏔᎾᏏ, Tanasi) is a state located in the southeastern United States. Tennessee is the 36th largest and the 17th most populous of the 50 United States. Tennessee is bordered by Kentucky and Virginia to the north, North Carolina to the east, Georgia, Alabama, and Mississippi to the south, and Arkansas and Missouri to the west. The Appalachian Mountains dominate the eastern part of the state, and the Mississippi River forms the state's western border. Tennessee's capital and second largest city is Nashville, which has a population of 601,222. Memphis is the state's largest city, with a population of 653,450.
Document 4: Ohio: On February 19, 1803, U.S. President Thomas Jefferson signed an act of Congress that approved Ohio's boundaries and constitution. However, Congress had never passed a resolution formally admitting Ohio as the 17th state. The current custom of Congress declaring an official date of statehood did not begin until 1812, with Louisiana's admission as the 18th state. Although no formal resolution of admission was required, when the oversight was discovered in 1953, Ohio congressman George H. Bender introduced a bill in Congress to admit Ohio to the Union retroactive to March 1, 1803, the date on which the Ohio General Assembly first convened. At a special session at the old state capital in Chillicothe, the Ohio state legislature approved a new petition for statehood that was delivered to Washington, D.C. on horseback. On August 7, 1953 (the year of Ohio's 150th anniversary), President Eisenhower signed a congressional joint resolution that officially declared March 1, 1803, the date of Ohio's admittance into the Union.
Document 5: Indiana: In order to decrease the threat of Indian raids following the Battle of Tippecanoe, Corydon, a town in the far southern part of Indiana, was named the second capital of the Indiana Territory in May 1813. Two years later, a petition for statehood was approved by the territorial general assembly and sent to Congress. An Enabling Act was passed to provide an election of delegates to write a constitution for Indiana. On June 10, 1816, delegates assembled at Corydon to write the constitution, which was completed in 19 days. President James Madison approved Indiana's admission into the union as the nineteenth state on December 11, 1816. In 1825, the state capital was moved from Corydon to Indianapolis.
Document 6: Oklahoma: Oklahoma is the 20th largest state in the United States, covering an area of 69,898 square miles (181,035 km2), with 68,667 square miles (177847 km2) of land and 1,281 square miles (3,188 km2) of water. It is one of six states on the Frontier Strip and lies partly in the Great Plains near the geographical center of the 48 contiguous states. It is bounded on the east by Arkansas and Missouri, on the north by Kansas, on the northwest by Colorado, on the far west by New Mexico, and on the south and near-west by Texas.
Document 7: Missouri's 8th congressional district: Missouri's 8th Congressional District is one of 435 congressional districts in the United States and one of eight congressional districts in the state of Missouri. The district encompasses rural Southeast Missouri and South Central Missouri as well as some counties in Southwest Missouri. The district stretches from the Bootheel in the south to the St. Louis southern exurbs of Festus, Hillsboro, and surrounding areas in the Lead Belt; it ranges in the east to counties along the Mississippi River and in the west to counties along the Ozark Plateau near Branson.
Document 8: Minnesota: In 1762 the region became part of Spanish Louisiana until 1802. The portion of the state east of the Mississippi River became part of the United States at the end of the American Revolutionary War, when the Second Treaty of Paris was signed. Land west of the Mississippi River was acquired with the Louisiana Purchase, although a portion of the Red River Valley was disputed until the Treaty of 1818. By the late 1700s, the North West Company had established the post of Fort Charlotte at the Lake Superior end of the Grand Portage, until moving 50 miles northeast to Fort William in 1803. In 1805, Zebulon Pike bargained with Native Americans to acquire land at the confluence of the Minnesota and Mississippi rivers. The construction of Fort Snelling followed between 1819 and 1825. Its soldiers built a grist mill and a sawmill at Saint Anthony Falls, the first of the water-powered industries around which the city of Minneapolis later grew. Meanwhile, squatters, government officials, and tourists had settled near the fort. In 1839, the army forced them to move downriver and they settled in the area that became St. Paul. Minnesota Territory was formed on March 3, 1849. The first territorial legislature (held September 2, 1849) was dominated by men from New England or of New England ancestry. Thousands of people had come to build farms and cut timber, and Minnesota became the 32nd U.S. state on May 11, 1858. The founding population was so overwhelmingly of New England origins that the state was dubbed "the New England of the West".
Document 9: Iowa: Almost immediately after achieving territorial status, a clamor arose for statehood. On December 28, 1846, Iowa became the 29th state in the Union when President James K. Polk signed Iowa's admission bill into law. Once admitted to the Union, the state's boundary issues resolved, and most of its land purchased from the Indians, Iowa set its direction to development and organized campaigns for settlers and investors, boasting the young frontier state's rich farmlands, fine citizens, free and open society, and good government.
Document 10: Missouri: Missouri is landlocked and borders eight different states as does its neighbor, Tennessee. No state in the U.S. touches more than eight. Missouri is bounded by Iowa on the north; by Illinois, Kentucky, and Tennessee across the Mississippi River on the east; on the south by Arkansas; and by Oklahoma, Kansas, and Nebraska (the last across the Missouri River) on the west. Whereas the northern and southern boundaries are straight lines, the Missouri Bootheel protrudes southerly into Arkansas. The two largest rivers are the Mississippi (which defines the eastern boundary of the state) and the Missouri River (which flows from west to east through the state) essentially connecting the two largest metros of Kansas City and St. Louis.
Document 11: Mississippi: Mississippi ( (listen)) is a state located in the southeastern region of the United States. Mississippi is the 32nd largest and 34th-most populous of the 50 United States. Mississippi is bordered to north by Tennessee, to the east by Alabama, to the south by the Gulf of Mexico, to the southwest by Louisiana, and to the northwest by Arkansas.  Mississippi's western boundary is largely defined by the Mississippi River.  Jackson is both the state's capital and largest city.  Greater Jackson, with an estimated population of 580,166 in 2018, is the most populous metropolitan area in Mississippi and the 95th-most populous in the United States.
Document 12: Missouri River: The Missouri makes a bend to the southeast as it winds through the Great Plains, receiving the Niobrara River and many smaller tributaries from the southwest. It then proceeds to form the boundary of South Dakota and Nebraska, then after being joined by the James River from the north, forms the Iowa -- Nebraska boundary. At Sioux City the Big Sioux River comes in from the north. The Missouri flows south to the city of Omaha where it receives its longest tributary, the Platte River, from the west. Downstream, it begins to define the Nebraska -- Missouri border, then flows between Missouri and Kansas. The Missouri swings east at Kansas City, where the Kansas River enters from the west, and so on into north - central Missouri. To the east of Kansas City, the Missouri receives, on the left side, the Grand River. It passes south of Columbia and receives the Osage and Gasconade Rivers from the south downstream of Jefferson City. The river then rounds the northern side of St. Louis to join the Mississippi River on the border between Missouri and Illinois.
Document 13: Geography of Illinois: Illinois is in the midwestern United States. Surrounding states are Wisconsin to the north, Iowa and Missouri to the west, Kentucky to the south, and Indiana to the east. Illinois also borders Michigan, but only via a northeastern water boundary in Lake Michigan. Nearly the entire western boundary is the Mississippi River, except for a few areas where the river has changed course. Illinois' southeastern and southern boundary is along the Wabash River and the Ohio River. Whereas, its northern boundary and much of its eastern boundary are straight survey (longitudinal and latitudinal) lines. Illinois has a maximum north - south distance of 390 miles (630 km) and 210 miles (340 km) east - west. Its total area is 57,918 square miles (150,010 km).
Document 14: History of Idaho: When President Benjamin Harrison signed the law admitting Idaho as a U.S. state on July 3, 1890, the population was 88,548. George L. Shoup became the state's first governor, but resigned after only a few weeks in office to take a seat in the United States Senate.
Document 15: Geography of Missouri: Missouri river from its mouth at St. Louis to Columbia. This also corresponds to the southernmost extent of glaciation during the Pre-Illinoian Stage which destroyed the remnant plateau to the north but left the ancient landforms to the south unaltered. The Ozark boundary runs southwestward from there towards Joplin at the southeast corner of Kansas. The boundary between the Ozark and lowland regions runs southwest from Cape Girardeau on the Mississippi River to the Arkansas border just southwest of Poplar Bluff. Missouri borders eight other US States, more than any other state except Tennessee, which also borders eight states.
ground_truth: President James K. Polk
sub_queries: Which state is to the north of Missouri? Answer: Iowa
who was president when Iowa became a state Answer: President James K. Polk