Question: Which american president's father was a farmer and he was a former US representative from NY?

full_context: Document 1: Presidency of Franklin Pierce: The presidency of Franklin Pierce began on March 4, 1853, when Franklin Pierce was inaugurated as President of the United States, and ended on March 4, 1857. Pierce, a Democrat from New Hampshire, took office as the 14th United States president after routing Whig Party nominee Winfield Scott in the 1852 presidential election. Seen by fellow Democrats as pleasant and accommodating to all the party's factions, Pierce, then a little-known politician, won the presidential nomination on the 49th ballot of the 1852 Democratic National Convention.
Document 2: Compromise of 1850: The Compromise of 1850 was a package of five separate bills passed by the United States Congress in September 1850, which defused a four-year political confrontation between slave and free states on the status of territories acquired during the Mexican–American War (1846–1848). The compromise, drafted by Whig Senator Henry Clay of Kentucky and brokered by Clay and Democratic Senator Stephen Douglas of Illinois, reduced sectional conflict. Controversy arose over the Fugitive Slave provision. The Compromise was greeted with relief, but each side disliked some of its specific provisions:
Document 3: John Q. Farmer: John Quincy Farmer (August 5, 1823 in Burke, Vermont – August 1904) was a Minnesota politician, jurist, and Speaker of the Minnesota House of Representatives. He was first served in the Minnesota House of Representatives in 1866, and was elected speaker one year later, serving in the position until he left the house in 1868. He later served in the Minnesota Senate from 1871 to 1872, and was a judge for Minnesota's 10th judicial district from 1880 to 1893.
Document 4: James K. Polk: James Knox Polk (November 2, 1795 – June 15, 1849) was the 11th President of the United States (1845–49). He previously served as the 13th Speaker of the House of Representatives and as Governor of Tennessee. A protege of Andrew Jackson, Polk was a member of the Democratic Party and an adherent of Jacksonian democracy and Manifest Destiny. During his presidency, the United States expanded significantly with the annexation of Republic of Texas, the Oregon Treaty, and the conclusion of the Mexican-American War.
Document 5: Nathaniel Fillmore: Nathaniel Fillmore Jr. (April 19, 1771 – March 28, 1863) was an American farmer, and the father of Millard Fillmore, the 13th President of the United States.
Document 6: William Riley Dunham: William Riley Dunham (1856–1921), “the man known by name by more men, women and children than any other one man in Tipton County,” according to a 1912 issue of the Kempton Courier, was a member of the Indiana General Assembly, representing Hamilton and Tipton counties from 1913-1915. William Riley was born to Samuel Goodnight Dunham and Eliza Matilda Reese, President Barack Obama's great-great-great grandparents, making him President Barack Obama's great-great-great uncle. William Riley died in 1921 of "traveling sickness."
Document 7: Jesse Root Grant: Jesse Root Grant  (January 23, 1794 – June 29, 1873) was a farmer, tanner and successful leather merchant who owned tanneries and leather goods shops in several different states throughout his adult life. He is best known as the father of Ulysses S. Grant and the one who introduced Ulysses to military life at West Point. Jesse was born in Greensburg, Pennsylvania and was one of seven children. He was a self made man who rose from poverty to become a somewhat wealthy merchant. At age five, Jesse's family moved to Ohio and settled in the . Unable to support all his children Jesse's father arranged for his apprenticeship at farms and tanneries during his youth. Jesse married Hannah Simpson and they became the parents of three boys and three girls, with Ulysses being their oldest. Raised in a poor family that was forced to split up and having to work at an early age, Jesse persistently encouraged his sons in the ways of education, industry and hard work, his methods sometimes testing his father-son relationship with Ulysses. As a young man he worked for and came to know Owen Brown and soon acquired strong abolitionist sympathies. Originally a Jacksonian, Jesse eventually broke with the Democrats as he developed anti-slavery leanings, and for a time wrote a number of controversial editorials in support of abolition and about other issues, including Ulysses at Shiloh. He became involved in local politics and was elected Mayor in Georgetown and later, Bethel, both in Ohio. During the American Civil War Jesse and his two partners became involved in cotton speculation and personally prevailed upon his son Ulysses, now a Commanding General, requesting permits to deal in cotton in Grant's district, causing serious complications. Soon after the war Jesse stood next to his son Ulysses while he was sworn in as President, thereafter becoming a frequent visitor to the White House, while living out his final years in Covington, Kentucky. Much has been learned about the earlier years of his son Ulysses from letters between the two and other material relating to Jesse's background and business.
Document 8: James Buchanan: James Buchanan Jr. ( ; April 23, 1791June 1, 1868) was the 15th President of the United States (1857–61), serving immediately prior to the American Civil War. He is the only president from Pennsylvania, the only president to remain a lifelong bachelor, and the last president born in the 18th century. A member of the Democratic Party, he was the 17th United States Secretary of State and served in the United States Senate and United States House of Representatives.
Document 9: Martin Van Buren: Martin Van Buren (Dutch: "Maarten van Buren" ; December 5, 1782 – July 24, 1862) was the eighth President of the United States (1837–41). A founder of the Democratic Party, he served in a number of senior roles, including eighth Vice President (1833–37) and tenth Secretary of State (1829–31), both under Andrew Jackson. Van Buren won the presidency by promising to continue Jackson's policies. Shortly after taking office, the Panic of 1837 struck the nation, and his inability to deal effectively with the economic crisis, combined with the growing political strength of the opposition Whig Party, led to his defeat. During his half-century of public service, he built, perfected, and defended a new system of political parties at first the state and then the federal level.
Document 10: Nathaniel P. Banks: Nathaniel Prentice (or Prentiss) Banks (January 30, 1816 – September 1, 1894) was an American politician from Massachusetts and a Union general during the Civil War.
Document 11: Millard Fillmore: Millard Fillmore (January 7, 1800March 8, 1874) was the 13th President of the United States (1850–53), the last to be a member of the Whig Party while in the White House. A former U.S. Representative from New York, Fillmore was elected the nation's 12th Vice President in 1848, and was elevated to the presidency by the death of Zachary Taylor. He was instrumental in getting the Compromise of 1850 passed, a bargain that led to a brief truce in the battle over slavery. He failed to win the Whig nomination for president in 1852; he gained the endorsement of the nativist Know Nothing Party four years later, and finished third in that election.
Document 12: John Quincy Adams: John Quincy Adams ( ; July 11, 1767 – February 23, 1848) was an American statesman who served as a diplomat, United States Senator, member of the House of Representatives, and the sixth President of the United States from 1825 to 1829. He was a member of the Federalist, Democratic-Republican, National Republican, and later the Anti-Masonic and Whig parties. He was the son of President John Adams and Abigail Adams and thus contributed to the formation of the Adams political family.
Document 13: James Earl Carter Sr.: James Earl Carter Sr. (September 12, 1894 – July 22, 1953) was an American businessman, farmer, and legislator from Plains, Georgia. He was the father of former President of the United States, Jimmy Carter (born 1924), William Alton "Billy" Carter (1937–1988), Gloria Carter Spann (1926–1990), and Ruth Carter Stapleton (1929–1983).
Document 14: John C. Frémont: John Charles Frémont or Fremont (January 21, 1813July 13, 1890) was an American explorer, politician, and soldier who, in 1856, became the first candidate of the anti-slavery Republican Party for the office of President of the United States. During the 1840s, when he led four expeditions into the American West, that era's penny press and admiring historians accorded Frémont the sobriquet "The Pathfinder".
Document 15: Presidency of James Buchanan: The presidency of James Buchanan began on March 4, 1857, when James Buchanan was inaugurated as President of the United States, and ended on March 4, 1861. Buchanan, a Democrat from Pennsylvania, took office as the 15th United States president after defeating former President Millard Fillmore of the American Party, and John C. Frémont of the Republican Party in the 1856 presidential election.
ground_truth: Millard Fillmore