Nancy Pelosi’s negotiating prowess was on full display on Tuesday, as she and Senate Minority Leader Chuck Schumer openly sparred with President Donald Trump on live television.

Pelosi’s negotiation tactics are considered her greatest strength. Often, these negotiations take place behind closed doors, at all hours of the day or night; Pelosi is famous for 2 am meetings with members to hash out policy differences on large bills until a consensus is reached.

One member, Rep. Emanuel Cleaver (D-MO) once told Vox Pelosi cannot ever be underestimated: “I think Nancy Pelosi is one of the smartest people in Congress. I think she’s almost like a shark; I don’t think she sleeps. She is as tough as they come.”

But Tuesday’s negotiation didn’t take place behind closed doors. The fully televised meeting an added element of surprise from the White House that neither Pelosi nor Schumer were fully prepared for, according to an aide. Pelosi and Schumer had met the night before in her office to go over the details of who would say what, but convincing the president of the United States to wholeheartedly take credit for a possible shutdown wasn’t part of the plan — at first.

“I don’t think that was necessarily their plan going in,” the aide said. “They didn’t know it’s all going to be televised, they saw it was an opportunity to nudge him to jump. He totally went for it.”

How Democratic leaders got Trump to own a government shutdown

The night before the meeting at the White House, Democrats started to suspect Trump was laying a trap for them. They didn’t know Vice President Mike Pence would even be at the negotiation until they received a guidance from his office the night before, and they only realized the meeting would be televised when they walked into the Oval Office.

The House Democratic leader is known as someone who wins over holdouts through a combination of carrots and sticks. On Tuesday, Trump got a version of Pelosi that was decidedly more stick than carrot.

Pelosi branded any impending government shutdown as a “Trump shutdown.”

“I think the American people recognize that we must keep the government open, that a shutdown is not worth anything, and that you should not have a Trump shutdown,” Pelosi said at the very beginning of her televised meeting with Trump on Tuesday.

“A what? Did you say Trump?” the president responded, with a smirk on his face.

The next 15 minutes was a bit like watching a good cop, bad cop routine — Pelosi calmly goading the president by repeatedly informing him he did not have enough votes in the House to pass a border wall, and Schumer going head-to-head with Trump. Both Democratic leaders had one mission: to get under the president’s skin.

By the end of the meeting, Trump had the final word: accepting the shutdown as his own.

“You want to know something? I’ll take it,” Trump said. “Yes, if we don’t get what we want one way or the other, whether it’s through you, through military, through anything you want to call — I will shut down the government. I am proud to shut down the government. I will take the mantle.”

As Trump railed about being proud to shut down the government over border security, Democratic leaders were confident they had won the battle — apparent in the satisfied smile and repeated nods from Schumer. Pelosi went back to the US House and walked into a meeting of senior House Democrats to declare victory.

“The fact is, we did get him to say, to fully own that the shutdown was his,” Pelosi told them. “That was an accomplishment.”

Pelosi is one of the most effective negotiators in history. But she’s dealing with a man who is impossible to pin down.

Pelosi one of the most effective House speakers in US history thanks to her attention to detail and ability to come to a negotiation more prepared than the other party.

“She’s meticulous,” the aide said. “She’s always prepared. When we prepare her for something, she does not want to know the minimum, she wants to know the maximum.”

Former and current aides and House Democratic members often talk about Pelosi’s ability to remember even the most miniscule details about the members of her caucus and their wants and needs. Pelosi uses that knowledge to know what promises she can make to get them to sign onto a piece of legislation or hold firm in opposition to Republicans.

“She’s damn good!” Rep. Mark Pocan (D-WI) told reporters on Tuesday. “Personally, you don’t want to ever be on the other side of a negotiation with her, because you’re at a disadvantage.”

In theory, her preparedness and attention to detail should make Pelosi the perfect person to deal with Trump — a man who prefers one-page memos to briefing books. But unlike most of the people she deals with, Trump’s ever-changing whims can make him impossible to pin down.

Still, Pelosi’s depth of knowledge makes her a formidable opponent for the president out of sheer stamina, according to the aide.

“In a public situation like that she can keep going, because she knows everything and he doesn’t,” said the aide.

But whether Democrats and the president can actually reach a deal is another matter entirely. The president showed himself to be impossible to negotiate with during the weeks leading up to the government shutdown in January. Schumer and Senate Democrats came armed with a proposal that would have given Trump $20 billion for his border wall in exchange for a deal on the Deferred Action for Childhood Arrivals (DACA) program, far more than the $5 billion the president is currently asking for.

Trump still said no.

Pelosi announced she had another productive conversation with Trump on Tuesday night after she left the White House. But the Democratic leader kept goading the president, trying to get under his skin even as she went back to the House.

“It’s like a manhood thing for him,” Pelosi told House Democrats at a meeting. “As if manhood could ever be associated with him. This wall thing.”