TOKYO (AP) — Ben Smith scored two vintage tries before halftime, Keiran Read did a power of work and Sonny Bill Williams produced a pair of trademark offloads as three veteran All Blacks went into retirement with a bronze medal to add to their previous Rugby World Cup titles.

Six days after a semifinal loss to England ended New Zealand’s bid for a third straight world championship, the All Blacks beat Wales 40-17 on Friday in the third-place playoff.

No surprises there. The All Blacks hadn’t lost back-to-back tests since 2011, and their last lost to Wales was 66 years ago.

A new champion will be determined Saturday in Yokohama when South Africa and England meet in a rematch of the 2007 final, which the Springboks won 15-6.

On a cool night at Tokyo Stadium, Smith, Read and Williams took cameos to cap their long careers. It was also the last match in charge for both head coaches, with Steve Hansen ending a long tenure at the All Blacks to move to Japan and Warren Gatland returning to New Zealand to coach a Super Rugby club after 12 years with Wales.

The swathe of retirements added some luster to a match that usually is one that neither team wants to play, but also one that neither team wants to lose.

New Zealand opened the scoring in the fifth minute when Joe Moody strode 20 meters before sliding over for a rare front-rower’s try. It was set up by an offload from Read to Brodie Retallick, who made good ground before delivering a clever, back-handed flick pass to his prop.

Fullback Beauden Barrett combined with Aaron Smith to score and make it 14-0 after 14 minutes.

But Wales responded with some enterprising rugby, a contrast to the grinding performance the Six Nations champions delivered in the 19-16 semifinal loss to South Africa last weekend.

And after twice taking the attacking option to kick for touch instead of goal, the Welsh were rewarded with a try when fullback Hallam Amos crossed in the 19th minute.

Rhys Patchell converted the try and added a penalty goal in the 27th to reduce the margin to four points, but the All Blacks pulled away with two tries from Ben Smith before halftime.

The 33-year-old utility, playing his final test on the right wing, opened with a classic veteran’s try. He chimed into the backline from the blind, running right to left, stopped, propped inside a defender and stepped back the other way before twisting over the line in a 20-meter solo effort.

He added a second after the whistle went for halftime, using a perfectly-timed hand-off to beat a tackle from Tomos Williams and race over inside the right corner post.

It was 28-10 at halftime and the All Blacks made it a 25-point difference two minutes after the break when Ryan Crotty scored after taking a brilliant offload from Sonny Bill Williams.

Six minutes later, Williams and Smith combined for what appeared to be a try, but it was disallowed by the Television Match Official.

Williams, making a rare starting appearance in this tournament after being a midfield regular, smiled, waved and took a small bow to the crowd as he left the field before the hour.

Josh Adams scored a consolation try on the hour, but the All Blacks capped it when flyhalf Richie Mo’unga scored five minutes from the end to bring his tally to 15 points for the match, including five conversions.