Open-minded flexibility is the only rigid rule the Chiefs and 49ers have had in common as they traveled their different paths to Hard Rock Stadium for Super Bowl LIV on Sunday.

“Any way you can get here, you get here,” Chiefs General Manager Brett Veach said. “So, yeah, it’s gratifying when you look back and realize all that went into the different decisions you made as an organization to get here.”

How these teams got here is a fascinating tale of top-to-bottom malleability.

It’s 61-year-old Chiefs coach Andy Reid using a new-age offense in hopes of adding a Super Bowl ring to his record as the sixth-winningest coach in NFL history. It’s 40-year-old 49ers coach Kyle Shanahan using his father Mike’s old-school running mentality in hopes of completing the first father-son combo to lift the Lombardi Trophy.

It’s Kansas City drafting a quarterback 10th overall when Alex Smith had made the playoffs four times in five years. Or blowing up an entire defense after coming within one encroachment penalty of knocking off Tom Brady and reaching last year’s Super Bowl.

“We just knew we had to get better,” Veach said. “We knew we had to get more aggressive.”

It’s hiring Shanahan as your fourth head coach in four seasons, having him handpick his general manager and then ignoring the rest of the league’s snickers when the choice is John Lynch, a great former player and Fox analyst who had spent nary a day as a personnel guy.

“I always chuckled when people asked, ‘Gosh, will he be willing to work?’ ” Lynch said. “When you’ve been in this league, it’s what you’ve done your whole career is work. It’s a different kind of work. But it’s the mentality you have and the ability to communicate a vision.”

These blueprints can be fleeting, especially when they’re not rooted in a 20-year relationship between Brady and Bill Belichick.

The Falcons haven’t made the playoffs since they blew that 28-3 lead in the Super Bowl three years ago. The Eagles are 1-2 in the postseason since their confetti fell in Minneapolis. And last year’s geniuses in Los Angeles finished third in the NFC West this year.

But that’s yesterday’s news. Miami’s 11th Super Bowl will put a period on the league’s first 100 seasons. Let’s look at how the two participants got here.

It starts up front

Neither team was immune to injuries this season. But overall depth and a knack for consistently hitting on offensive linemen helped carry the 49ers to their seventh Super Bowl and put the Chiefs in their first one since beating the Vikings 50 years ago.

In October, Veach signed nine-year veteran Stefen Wisniewski off the street for depth purposes.

“An underrated signing, for sure,” said safety Tyrann Mathieu.

Wisniewski sat for weeks until left guard Andrew Wylie was hurt in Week 15. Wylie’s health returned, but Wisniewski was too good to pull. So the former Eagle will play in his second Super Bowl in three years.

“The knack for spotting an offensive lineman starts with Coach Reid,” Kansas City offensive line coach Andy Heck said. “He played O-line. He used to coach it. He knows one when he sees one.”

In San Francisco, the 49ers spent time with three backups on a line that paved the way for the league’s No. 2-ranked running game.

At tackle, rookie sixth-round draft pick Justin Skule played eight games for Joe Staley. The 49ers went 8-0. Daniel Brunskill, a former Alliance of American Football journeyman, played seven games for right tackle Mike McGlinchey. The 49ers went 6-1.

And when center Weston Richburg suffered a season-ending injury late in the year, it was Ben Garland, an unheralded offseason signing, who stepped up.

Garland signed with Denver as an undrafted rookie in 2012. He was with the Falcons when they played in the Super Bowl with Shanahan as their offensive coordinator.

He had started only nine career games when Weston went down. Now, he has started five straight for the 49ers, including a pair of 17-point playoff wins that featured 471 yards and six touchdowns rushing for Shanahan’s offense.

These things don’t happen by chance.

Unconventional relationships

Reid’s only other Super Bowl appearance as a head coach came 15 years ago for Philadelphia. That was the same year he met Veach, a Delaware receiver who caught passes from Matt Nagy, an apple from Reid’s coaching tree and now coach of the Bears.

Veach was an unpaid gofer that year. Incessantly hard work and an eye for talent — including a certain reigning league MVP quarterback — kept pushing Veach up the ranks.

“When Andy went from Philadelphia to Kansas City, he made a concerted effort to get back to what he loved doing, which was coaching, teaching,” said Brad Childress, the former longtime Reid assistant and Vikings coach. “Not that he got entirely away from that in Philadelphia, but in Kansas City, he doesn’t do as much on the personnel side.”

Reid doesn’t run the personnel side, but he does have final say. John Dorsey was his general manager from 2013 to ’16. Veach had worked his way up to co-player personnel director by 2015 and, at age 38, he replaced Dorsey when he was fired in 2017.

Reid is 20 years older than Veach. But they have been on the same page for 15 years and neither is known for having a big ego.

Meanwhile, the critics harpooned the Shanahan-Lynch union when it began in 2017. A new head coach handpicking a GM who had never even been a scout cried out Cleveland-esque laughingstock potential.

And, remember, at the time, the 49ers had gone back-to-back years with one-and-done coaches in Jim Tomsula and Chip Kelly. And right before that was the ego-driven crash and burn of coach Jim Harbaugh and GM Trent Balke.

Shanahan-Lynch started 0-9. But it was about that time that Belichick called out of the blue and offered quarterback Jimmy Garoppolo for a second-round draft pick.

“We had inquired about him at the combine and were given a firm no,” Shanahan said. “So it was a random call we weren’t expecting.”

Garoppolo’s season-ending knee injury after three games last season was the primary factor in the 4-12 record. But it wasn’t the only one considering the defense set NFL records for fewest takeaways (seven) and interceptions (two) in a season.

Today, San Francisco is only the third team in NFL history to go from fewer than five victories to the Super Bowl.

Overhauling a good defense

The Chiefs like to say they were 4 inches from the Super Bowl last year. That’s about how far Dee Ford lined up offsides on the penalty that negated what would have been an AFC-clinching interception of Brady in last year’s conference title game.

But the reaction to that loss on defense was far greater than 4 inches. It started with defensive coordinator Bob Sutton being fired the next day and ended with that side of the ball being blown up and rebuilt to fit a new scheme under coordinator Steve Spagnuolo.

“It’s tough to accept change or go through with change when you’re winning games,” Veach said. “But, you know, we scored at such a rapid pace last year that we just knew we had to get better on defense.

“We knew we had to get a different mind-set and get more aggressive with our mentality. That’s why we went that direction with Tyrann Mathieu and [end] Frank Clark. Those guys just bring the best out of the people around them.”

Veach traded Ford to the 49ers. He sent a first- and a second-round pick to Seattle for Clark and then paid him more than $160 million.

He said goodbye to talented players Justin Houston and Eric Berry. He targeted Mathieu over the radar and guys such as former Gophers linebacker Damien Wilson under the radar. And he didn’t stop once the season started. Needing help for the pass rush down the stretch, he signed 37-year-old Terrell Suggs.

Lynch’s rebuilding has been more gradual. And it helps that a 4-12 record landed yet another outstanding pass rusher in Nick Bosa at No. 2 overall in the draft.

But he did make George Kittle the ninth tight end taken in 2017. All Kittle has done is become All-Pro first-team and an instrumental piece in Shanahan’s running and passing games.

Lynch also took receiver Deebo Samuel and linebacker Dre Greenlaw in the second and fifth rounds, respectively, this year. And he signed cornerback Emmanuel Moseley as an undrafted rookie in 2018. All have been impactful while Greenlaw’s late stop at the goal line against the Seahawks meant the difference between getting home-field advantage throughout the playoffs and having to win three in a row on the road as the No. 5 seed.

Mahomes a ‘different animal’

At Chiefs headquarters, it was Veach, as then-co-player personnel director and tireless watcher of game film, who first slammed his hand down and declared that Patrick Mahomes, the unorthodox and allegedly system quarterback in Texas Tech’s Air Raid offense, would be, as Reid remembers it, “perfect for our offense.”

“I’ve learned over the years that when Brett likes a guy, I should listen,” Reid said.

He did. But Kansas City, sitting at No. 27 in the draft, had to hide their interest in Mahomes leading up to the 2017 draft. Reid purposely avoided Texas Tech’s pro day and fell in love when Mahomes aced his personal workout with the Chiefs.

“By the time we got to draft day, we felt pretty confident that we were out ahead of most of the teams on Patrick,” Veach said. “But you never know when there might be a run at a position.”

The Chiefs targeted the Bills at No. 10 as a trade partner.

“When the Bears traded up from 3 to 2 [with the 49ers] and took a quarterback [Mitchell Trubisky], we started to panic a little bit,” Veach said. “Was the cavalry charge coming up for a quarterback? We didn’t really relax until Cincinnati picked John Ross at 9.”

Yeah, but what about all that pre-draft chatter about Mahomes not translating to the NFL?

“He had such a rare arm,” Veach said. “On the one hand, you didn’t see the footwork you wanted to see, but on the other hand not many people possess that arm.

“Plus, there was all this talk about guys having gaudy numbers in that Air Raid offense and not translating to the NFL. But we were just dealing with a different animal with this kid because of what he can do with the football, his ad-lib ability and elevate the people around him.”

According to Shanahan, the 49ers didn’t take Mahomes seriously enough because Shanahan had his mind set on reuniting with Kirk Cousins a year later when Cousins was certain to leave Washington.

Six months later, Belichick called offering Garoppolo. And, well, sorry, Kirk.

To get to the Super Bowl, you have to be flexible.