THOUSAND OAKS, Calif. -- Sean McVay's message to Kyle Shanahan when he accepted his first head-coaching job: "I can't tell you how happy I am for you, but I can't believe I've got to see you twice a year now."

The long-standing rivalry between the Los Angeles Rams and the San Francisco 49ers, often-times intense during the Rams' original stint in Southern California, now has a compelling new twist: McVay, whose grandfather was part of five Super Bowl titles as a 49ers executive, is the Rams' new head coach. Shanahan, initially deemed a favorite for the Rams' vacant post, is the 49ers' new head coach.

Rams coach Sean McVay said that new 49ers coach Kyle Shanahan had a strong influence on his offensive beliefs. Lisa Blumenfeld/Getty Images

And, of course, they have history.

Shanahan was the Redskins' offensive coordinator from 2010-13, while his father, Mike Shanahan, served as head coach. McVay coached tight ends during that four-year stretch, then replaced Shanahan as offensive coordinator after he departed for the Browns.

"Kyle is a guy who’s had a tremendous influence on some of the things I believe in offensively," McVay said. "He’s a great coach, and I wish him nothing but the best for 14 games -- except for those two next year.”

The 49ers won only two games under Chip Kelly in 2016, but both of those wins came against the 4-12 Rams that were led by Jeff Fisher. They embarrassed the Rams, 28-0, during the Monday Night Football opener from Levi's Stadium, then came from behind to hand them a 22-21 loss at Los Angeles Memorial Coliseum in the second-to-last game of the regular season.

By that point, McVay was calling plays for the Redskins and Shanahan was offensive coordinator for the Falcons, who had an MVP quarterback in Matt Ryan and put together one of the most impressive offensive seasons in NFL history. The Rams were scheduled to meet with Shanahan during the weekend of the Falcons' playoff bye week, but inclement weather derailed their plans. They rescheduled for the following weekend, but ultimately hired McVay days earlier, making one of the biggest decisions in franchise history without even sitting down with Shanahan.

The Rams felt they had their guy and didn't really care to wait, but only time will tell if they made the right decision.

The Rams and 49ers finished first or second 11 times from 1970-89. But that seems like a lifetime ago. They've been the two worst teams in the NFC West each of the past three years, and it'll be up to McVay and Shanahan, two of the game's sharpest offensive minds, to turn their respective fortunes around.

Shanahan, who accepted the job immediately after the Falcons' devastating loss to the Patriots in Super Bowl LI, is six years older than McVay, who, at 31, is the youngest coach in the NFL's modern era.

The Grudens, Jon and Jay, were major influences on McVay -- but so were the Shanahans.

"We’re all a product of our experiences," McVay said. "Certainly Kyle and Coach Shanahan’s offense has had a big influence on what I believe and how I think you want to attack a defense. But it’s going to be something that’s going to be an ongoing process, figuring out our players first and then how we fit that scheme to their skill sets.”