Former vice president Joe Biden and Sen. Kamala D. Harris of California, who clashed at the first Democratic debate, will face off again in the next two-night debate at the end of July, while the ideologically aligned Vermont Sen. Bernie Sanders and Massachusetts Sen. Elizabeth Warren will appear together the other night.

Who is matched with whom can shift the trajectory of the race, as Harris showed in the first debate when she went after Biden on the issue of busing and race. It created a Harris vs. Biden narrative and helped catapult Harris toward the top of the national polls. The aftershocks of that moment were felt for days later, culminating in Biden giving a major speech defending his civil rights record.

A rematch gives Harris another shot to handicap Biden, while Biden gets an opportunity for a do-over after his fumbling performance against Harris last time.

For socialist democrat Sanders and capitalist Warren, who are vying for many of the same far-left voters, their matchup allows them the chance to differentiate. It also denies Sanders a chance to go after Biden, whom he competes with for the populist and working-class vote. In the past week, Sanders has targeted Biden for not embracing Medicare-for-all, providing a preview of how hard he planned to go after Biden if given the opportunity.

Debate host CNN held a live drawing on Thursday night to determine the lineups.

The Democrats wanted to avoid having separate first-tier and second-tier debates like Republicans did in 2016, so instead chose to randomly divide the whole field over two nights. It happened anyway in the first debate in June when all the top-polling candidates except for Warren were drawn for the same night.

This time, the candidates were divided into three tiers, and each tier was split between the two nights in an effort to ensure the nights were balanced. Biden, Warren, Harris and Sanders were in the top tier based on their poll rankings, guaranteeing two top candidates would debate each night.

Joining Sanders and Warren on the first night, July 30, will be South Bend, Ind., Mayor Pete Buttigieg; former congressman Beto O’Rourke; Sen. Amy Klobuchar of Minnesota; Montana Gov. Steve Bullock; Ohio Rep. Tim Ryan; former Colorado governor John Hickenlooper; former Maryland congressman John Delaney; and author Marianne Williamson.

The next night, July 31, with Biden and Harris, will be former housing secretary Julián Castro, entrepreneur Andrew Yang, Sen. Cory Booker of New Jersey, Sen. Kirsten Gillibrand of New York, New York Mayor Bill DeBlasio, Sen. Michael F. Bennet of Colorado, Hawaii Rep. Tulsi Gabbard, and Washington Gov. Jay Inslee.

The Democratic field is the most diverse ever and yet all five minority candidates ended up on the same night. If Harris does go after Biden again on race issues, he could face a pile-on with Booker onstage as well. Booker was actually the first candidate to take Biden to task for his comments about working with well-known segregationists early in his career.

O’Rourke, who raised a huge amount of money in his first 24 hours in the race, lost his early momentum while Buttigieg, who raised the most money of any candidate in the second quarter, surged. O’Rourke may try to recapture the mantle as the face of the next generation. Buttigieg, meanwhile, will have an opportunity to position himself as a pragmatist versus the more liberal Sanders and Warren.

To qualify for this debate, the candidates needed to register 1 percent support in three polls approved by the Democratic National Committee or have 65,000 unique campaign donors, with a minimum of 200 donors per state in at least 20 states. Four candidates — Rep. Seth Moulton (Mass.); former congressman Joe Sestak (Pa.); Miramar, Fla., Mayor Wayne Messam; and billionaire Tom Steyer, who entered the race last week — didn’t meet that threshold.

The entry qualifications for the third debate in September will roughly double, and candidates will be required to make the cut in both polling and donors, not simply one category. There will be no debate in August.