After months of negative news, American farmers rejoiced as the U.S. finally secured a trade deal with both Canada and Mexico.

The pact comes just as U.S. growers are harvesting mammoth corn and soybean crops and domestic meat production balloons. The outlook for big supplies combined with trade tensions, especially with China, had sparked a prolonged rout for agriculture markets.

Having all three North American countries agree on a deal has given traders and farmers reassurance that some flows of agricultural goods won’t be disrupted, particularly to Mexico, a major buyer of U.S. corn, soybeans, pork and cheese.

“This is a potential stoppage of the bearish trade narrative that U.S. agriculture has seen,” said Rich Nelson, chief strategist for Allendale Inc. in McHenry, Illinois.

Here’s a look at some of the markets impacted:

Hogs

The U.S. exports roughly a quarter of its annual pork production, with the total value reaching nearly $6.5 billion in 2017. Mexico is the top buyer of American pork by volume, including a large portion of ham, and Canada ranks fourth, according to data compiled by the U.S. Meat Export Federation.

The trade threats came as the U.S. hog herd swelled to a record, creating a glut of pork that was competing with rising supplies of beef and poultry. The news of the North American trade pact boosted hog futures on Monday. The December contract rose as much as 3.5 percent to 59.95 cents a pound in Chicago, the highest since June 14.

Corn

Corn prices popped Monday as the accord alleviates the risk that Mexico, the biggest importer of U.S. supplies, will turn to competing exporters such as Argentina. December corn futures on the Chicago Board of Trade gained 2.7 percent to close at $3.6575 a bushel, the biggest gain since March 29. Growers had watched prices tumble since May partly amid trade concerns.

Exports to Mexico have grown significantly since the 1994 North American Free Trade Agreement. The original pact has been seen as a success for U.S. agriculture, and many farming groups had pushed the Trump administration to “do no harm” as it renegotiated the deal. Last year, the U.S. exported $3.2 billion of corn and corn products to Mexico and Canada, according to the National Corn Growers Association.

“The markets have responded favorably,” Tanner Ehmke, manager of the knowledge exchange division at agricultural lender CoBank ACB in Greenwood Village, Colorado. “The main thing here is we’ve removed risk.”

Cheese

Cheese was one of the American goods targeted by the retaliatory duties Mexico imposed in June. That month, Rabobank International warned the duties could lead to lower shipments and weigh on prices for processors. U.S. dairy producers count on Mexico to buy more than a quarter of their cheese exports.

In addition to further securing trade with Mexico, the new deal offers greater access to Canada’s dairy market, including shipments of cheese without duties, Dave Kurzawski, a dairy analyst for INTL FCStone Financial Inc., said in a report.

The deal “will bring an end to months of nail-biting negotiations just ahead of the U.S. mid-term elections,” Kurzawski said. “The news appears friendly to the U.S. dairy industry.”

Cheese futures for October delivery rose as much as 1.3 percent, the biggest intraday gain since Aug. 27. Last week, the contract reached the lowest since it debuted in November 2016.