Correction appended, Sept. 8, 2016

President Hillary Clinton? President Donald Trump? The choice might not be so simple. There is still a path—albeit an implausible and narrow one—for an alternative.

If Clinton and Trump were to tie in the Electoral College and deadlock in the House of Representatives, the U.S. Senate would then choose between Vice Presidential nominees Tim Kaine and Mike Pence.

Here’s how this unlikely—but still possible—constitutional scenario would play out. Based on an 11-state battleground, 270 to Win calculated 32 possible ties, though not all are plausible. (It’s pretty unlikely that Clinton would win North Carolina while losing Virginia, for example.)

That figure goes up to 126 possibilities if you include the fact that Maine and Nebraska split their electoral votes by congressional district, unlike the rest of the states, and that each party could plausibly pick off one electoral vote in an otherwise reliably partisan state.

The number of mathematically possible ties varies depending on which states you consider to be tossups. Using RealClearPolitics’ list of 12 battleground states–including just one electoral vote from Maine—there are only 26 possible ties, according to TIME’s calculations. (It may seem strange that the number goes down with more battleground states, but such is the caprice of electoral math.)

The more likely scenario here is that a third-party candidate like Libertarian Gary Johnson or Never Trump Republican Evan McMullin wins a state like Utah and that, while Clinton and Trump don’t tie, they’re so close that neither win the majority of 270 electoral votes required, which would also throw the election to the House. According to TIME’s calculations, if Utah were to go to a third-party candidate, there are 141 cases where no candidate gets a majority, using the same set of 12 battleground states from RealClearPolitics.

Indeed, history tells us such unlikely situations have already happened. First in 1800 when the House chose Thomas Jefferson over his running mate Aaron Burr—back in the day the party put forth two choices for president (with four candidates overall) and designated their first and second choices. Jefferson, the Republican’s first choice, and Burr, the party’s second choice, both garnered 73 electoral votes (it should be noted that Jeffersonian Republicans were not the same party as the GOP today, which traces its roots to Abraham Lincoln). The House decided for Jefferson but the situation was so awkward that they quickly moved to hold a separate vote to pick the vice president—that vote eventually became the Senate’s responsibility.

The second time was in 1824. It wasn’t a tie but a four-way split failed to yield the required majority so the vote went to the House. Although Andrew Jackson had won the popular vote in that election, the House picked John Quincy Adams as president. Jackson went on to win the 1828 and 1832 elections outright.

If Clinton and Trump tied, or if no one reached the magic 270, the election would be thrown to the House of Representatives, where each state delegation gets one vote. Here’s where things get interesting. Currently, Republicans control 33 state delegations in the House; Democrats control 14; three —New Hampshire, Maine and New Jersey—are tied. But it would be the new Congress sworn in on January 3, 2017, that would break the tie.

All three tied states have swing seats in play in the election. In addition, another three states where Republicans hold narrow majorities in the delegations also have swing seats in play: Arizona, Colorado and Nevada. If the election swings Democratic down ballot, all six of those states could go to Democrats which would mean Democrats would control 20 states to the Republican’s 30.

That would still seem to indicate a Trump presidency, no? Here’s the rub: 11 states controlled by Republicans in the House are also swing states on the presidential level. So, what happens if Clinton won the popular vote in those states? Would those members feel obliged to vote the way their states voted or vote with their party? Trump, after all, isn’t terribly popular within his own party. Some Republicans might be tempted to vote with their voters. If at least half of those states did, the House would end up with a 25-25 deadlock.

What happens in the case of a second presidential tie? According to the 12th Amendment, “if the House of Representatives shall not choose a President whenever the right of choice shall devolve upon them, before the fourth day of March next following, then the Vice-President shall act as President, as in case of the death or other constitutional disability of the President.” That was later changed to the Vice President-Elect and to January 20 in the 20th Amendment.

The Vice President-Elect is chosen by the Senate in a separate process from the House, according to Amy Bunk, an attorney from the National Archives, which administers the Electoral College. If the Senate, as predicted by most observers right now, goes Democratic, then Virginia Sen. Tim Kaine would become president. If Republicans maintain control of the Upper Chamber, then Indiana Gov. Mike Pence will be the 45th president. If the Senate also deadlocks—the unlikeliest of unlikely scenarios—then the presidency would go to the next person in line, the Speaker of the House, currently Paul Ryan.

Again, all of this is extremely unlikely, but in this topsy-turvy year, never say never.

Correction: The original version of this story incorrectly suggested that an Electoral College tie followed by a tie in the House of Representatives could place current Vice President Joe Biden in the presidency. The story has been updated with additional reporting, including analysis from Amy Bunk, the lawyer who advises the Electoral College.

Get our Politics Newsletter. The headlines out of Washington never seem to slow. Subscribe to The D.C. Brief to make sense of what matters most. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Write to Chris Wilson at chris.wilson@time.com.