SEOUL (NYTIMES) - For more than half a century, South Korean voters have had to pick leaders capable of navigating fraught diplomatic waters.
Presidents there need to balance the demands and challenges of China, its biggest trade partner; the United States, its principal ally; and North Korea, a hostile rival with a growing stockpile of nuclear weapons and missiles.
But the election this year on May 9, just over a month after the country's ousted president was arrested on corruption charges and days after a US missile-defence system was activated, comes with an additional twist: President Donald Trump.
The American president has sent mixed signals about his approach to the Korean Peninsula. He has supported the deployment of the anti-missile system, which has angered China, but he has also said South Korea should pay for it. He has said US warships were steaming towards the region, only for it to emerge that they were not.
And he has questioned the sanity of Mr Kim Jong Un, the North's leader, but also called him a "smart cookie" with whom he might be willing to meet.
Here's a look at South Korea's three leading presidential candidates and how they might approach Mr Trump.
MOON JAE IN
Mr Moon, a 64-year-old human rights lawyer, leads the latest polls by a wide margin. A former student activist, he also served in the government of his friend Roh Moo Hyun, who was president from 2003 to 2008.
Mr Moon supports South Korea's alliance with Washington, but he has contended that the country needs a more balanced diplomatic approach to the US and China.
"I will create a government most feared by North Korea, most trusted by the United States and most reliable for China," he said in a nationally televised campaign speech in April.
His Democratic Party of Korea has criticised the country's current approach to Pyongyang, saying sanctions alone will not end the North's nuclear weapons programme.
If Mr Moon is elected, conservatives fear he will revive the "sunshine policy" of trying to build trust with North Korea through investment and dialogue. The policy, championed by Mr Roh and his predecessor, heralded a period of detente, but conservatives argue that it helped finance the North's nuclear weapons programme.
They also view Mr Moon as a replica of Mr Roh, a liberal who once said he would never "kowtow to the Americans". In a book published in January, Mr Moon said South Korea should learn to "say no to the Americans", and he has opposed the deployment of the anti-missile system, known as Terminal High Altitude Area Defence, or Thaad.
In a statement, a spokesman for Mr Moon accused Mr Trump of acting "unilaterally and without close bilateral consultations" after suggesting that South Korea should pay for Thaad.
AHN CHEOL SOO
Mr Ahn, 55, a centrist and founder of the People's Party, was polling around 10 per cent as recently as March, but he has seized on growing anxiety over North Korea to become a serious contender for the presidency.
Mr Ahn initially opposed the Thaad deployment, but he has since reversed that position and said it would be "irresponsible" to alter an agreement with an ally. That has been viewed as an attempt to woo conservative voters, who support the deployment.
"We should never recognise North Korea as a nuclear power," Mr Ahn said recently. "If the North is about to launch a nuclear attack, we should first strike the source of attack." It remains to be seen how successful Mr Ahn's play for the conservative vote will be.
The latest surveys have shown his surge in popularity fading, as Mr Hong Joon Pyo, the candidate of Park Geun Hye's conservative Liberty Korea Party, has narrowed the gap with him. That is the last snapshot of the public mood until the election; under election law, no polls conducted after Tuesday can be published.
A former physician who became a software mogul before entering politics, Mr Ahn, like Mr Trump, is from a wealthy, well-connected family and is often characterised as a populist. The men share something else in common: an alma mater.
Both Mr Ahn and Mr Trump attended the Wharton School of the University of Pennsylvania. During a debate in April, Mr Ahn said he would use his school connections and business background to build a rapport with the US president.
HONG JOON PYO
Mr Hong, 62, bills himself as the true representative of conservatives, who suffered a political body blow with Park's impeachment and have been looking for a new standard-bearer.
A cantankerous ex-governor and former prosecutor, Mr Hong has employed rhetoric that has been compared to Mr Trump's. He has said he would order the first executions in the country in two decades and crack down on "aristocratic unionists" whom he accuses of slowing the economy.
"If I am elected, the first thing I will do is to propose a summit meeting with President Trump on board the Carl Vinson," Mr Hong said this week, referring to the US aircraft carrier sent to the region in a show of force against North Korea.
Mr Hong has angered many people with his views on social issues - promising, for instance, to "crack down" on homosexuality, on the grounds that it spreads Aids. Homosexuality is a sensitive issue in South Korean politics, largely because many churchgoing voters oppose it, and Mr Moon has said that he does not approve of it.
Mr Hong also recently said that "washing dishes is women's work". And in a passage from his 2005 memoir that recently came to light, he describes participating in what appears to be an attempted date rape while in college.
In the book, Mr Hong writes that a roommate asked him and other friends to obtain a supposed aphrodisiac, which the roommate mixed into a beer that he gave to a girl.
"He said the drug did not work," Mr Hong wrote. "She woke up and put up strong resistance, biting and scratching him in the face."
After a furore erupted over the story, with rival candidates demanding that he quit the race, Mr Hong said he had merely relayed an anecdote that he had "overheard".