MIAMI (AP) — For the first time since 1997, the San Francisco 49ers are the top seed in the NFC playoffs, a stunning turnaround for a team that owned the second overall pick in the NFL draft just nine months ago.

After four straight losing campaigns, including only 10 wins in coach Kyle Shanahan’s first two seasons, the 49ers went from 4-12 to 13-3 this season.

They emerged as the top team in the NFC thanks a big-play offense and a vastly improved defense sparked by Nick Bosa, whom they chose with that No. 2 draft pick.

They earned the top seed with a thrilling finale at Seattle when rookie linebacker Dre Greenlaw made a stop inches from the goal line, earning his team a week off and up to two home games in the 49ers’ quest to reach the Super Bowl for the first time in seven years.

“It feels good to get where we’re at,” Shanahan said. “Our goal was to get in the playoffs, it feels much better with being the one seed. By now everyone knows there is only one team that is happy at the end of year.”

The Green Bay Packers secured the other first-round bye.

The Seahawks visit the Philadelphia Eagles on Sunday and the Minnesota Vikings visit the New Orleans Saints in the other NFC wild-card game.

1. SAN FRANCISCO 49ers (13-3). AP Pro32 Ranking: No. 3. Last Lombardi: Super Bowl 29, 49-26 over San Diego Chargers on Jan. 29, 1995. Last year: 4-12. First trip to NFC playoffs since 2013.

YEA: The 49ers have won different ways with the defense dominating early and the offense playing better late. The returns of edge rusher Dee Ford and S Jaquiski Tartt should help the defense return to its early season form. If QB Jimmy Garoppolo and the offense can maintain its play from the second half when the team ranked second in plays of at least 20 yards, the Niners should be tough to beat.

NAY: The Niners will still be missing at least one key defensive piece at the start of the playoffs in LB Kwon Alexander and several depth pass rushers also are out for the year. That could limit the improvement on defense and there is little playoff experience on offense with WR Emmanuel Sanders the only key skill position player who has been in the postseason. Garoppolo has improved the past few weeks but still has a propensity for turnovers, which could prove costly.

SAY: “We knew going into the year we had a chance to be pretty good with what we had on paper and watching the guys throughout training camp. We knew that pretty well after the first five games, we could feel it. Then you go through a number of injuries and stuff and you never know how you’re going to be able to fully handle that. That’s what I have been impressed the most with the guys, no one has wavered.” — Shanahan.

2. GREEN BAY PACKERS (13-3). AP Pro32 Ranking: No. 5. Last Lombardi: Super Bowl 45, 31-25 over Pittsburgh Steelers on Feb. 6, 2011. Last year: 6-9-1. First trip to NFC playoffs since 2016.

YEA: RB Aaron Jones is the team MVP. The third-year pro is Green Bay’s first 1,000-yard rusher since Eddie Lacy in 2014 and his 19 total touchdowns (16 rushing, three receiving) tied Carolina’s Christian McCaffrey for the league high. In the Packers’ three losses this season, Jones averaged fewer than 42 scrimmage yards. If first-year coach Matt LaFleur gets Jones the ball early and often and QB Aaron Rodgers can add in a splash of his old magic, Green Bay could find itself in Miami in February.

NAY: Though Rodgers has had flashes of his old greatness, the 36-year-old two-time MVP has played far below his soaring standards. Rodgers had a passer rating of less than 80.0 in each of his last three starts and had a career-high 16 overthrows against Detroit in the regular-season finale. If the Packers are going to win another Super Bowl, they’re going to need the Rodgers of old, not the old Rodgers.

SAY: “We haven’t always made it easy and we haven’t always made it pretty, but for the most part, we’ve found a way to win every game. You have to say a lot about the resiliency of this team, because we’ve gotten ourselves into a lot of different scenarios, but we always believe we can go out there and put up a bunch of points in a hurry.” — WR Davante Adams

3. NEW ORLEANS SAINTS (13-3). AP Pro32 Ranking: No. 2. Last Lombardi: Super Bowl 44, beat Indianapolis 31-17 on Feb. 7, 2010. Last year: No. 1 seed, beat Philadelphia Eagles 20-14 at home in divisional round, lost to Los Angeles Rams 26-23 (OT) in NFC championship at home. Third consecutive trip to NFC playoffs.

YEA: QB Drew Brees, who’ll turn 41 on Jan. 15, has been in vintage form lately with a big assist from the NFL’s top WR Michael Thomas. Brees has passed for 1,188 yards and 15 TDs in the past four games, evidence of his strong comeback from a thumb surgery that sidelined him five games. Thomas racked up a single-season record 149 catches for 1,725 yards and nine TDs. The Saints’ eight turnovers are an NFL record low for a season. New Orleans had 51 sacks, third most in the NFL and ranked fourth against the run.

NAY: While the Saints don’t have many weaknesses, they can be their own worst enemy. Their 120 penalties for 1,036 yards ranked sixth worst in the NFL in both categories and their minus-323 net penalty yards ranked second worst. New Orleans’ secondary has been beset with late-season injuries. Both starting safeties and a starting cornerback did not play in Week 17.

SAY: “Down the stretch here I think we’ve been an ascending team. We’ve been playing a little bit better each and every week, despite the fact that we have had some guys go down.” — Brees

4. PHILADELPHIA EAGLES (9-7). AP Pro32 Ranking: No. 11. Last Lombardi: Super Bowl 52, 41-33 over New England Patriots, Feb. 4, 2018. Last year: No. 6 seed, beat Chicago Bears 16-15 in wild-card game on road, lost to New Orleans Saints 20-14 in divisional round on road. Third consecutive trip to NFC playoffs.

YEA: The Eagles are hungry and Carson Wentz is determined to do what Nick Foles did in his absence two years ago — win a Super Bowl. If Wentz continues playing at the MVP level he displayed in December, the Eagles are dangerous. They have a strong rushing attack that can control the clock and an experienced defense that shuts down the run and forces teams to be one-dimensional.

NAY: Seattle beat the Eagles in Philadelphia 17-9 on Nov. 24. Russell Wilson is 4-0 against Philly. The Eagles have been riddled by injuries and finished the regular season without seven starters on offense. Three of those players could return to face the Seahawks but it’s likely two will be game-time decisions.

SAY: “In the last couple games, (Wentz) has really put this team on his back and said, ‘Hey, follow me.’ And I think that’s a sign of growth, a sign of maturity. I spent eight years in Green Bay with Brett Favre, and that’s what Brett did. Brett just put the team on his back when the chips were against us and just said, ‘Follow me.’ And that’s what Carson can do.” — Coach Doug Pederson.

5. SEATTLE SEAHAWKS (11-5). AP Pro32 Ranking: No. 6. Last Lombardi: Super Bowl 48, 43-8 over Denver Broncos on Feb. 2, 2014. Last year: No. 5 seed, lost to Dallas Cowboys 24-22 in wild-card game on road. Second consecutive trip to NFC playoffs.

YEA: Unlike years past, if the Seahawks are going to make a deep playoff run, it’s going to be because of QB Russell Wilson. He’s coming off the second-best season in terms of passing yards, completion percentage and a career-low five interceptions. Wilson’s never been asked to carry Seattle in the playoffs but if he can rediscover the success from when he was in the MVP conversation with Lamar Jackson, Seattle has enough other parts to make some noise.

NAY: Injuries have stacked up for Seattle. The Seahawks lost their top three running backs, a starting edge rusher, tight end and center to season-ending injuries. Jadeveon Clowney is playing through a painful core muscle injury. Bobby Wagner has a bad ankle as does safety Quandre Diggs. Left tackle Duane Brown underwent knee surgery after Week 16. Eventually the lack of some key stars is likely to catch up with Seattle.

SAY: “We have everything we want in the locker room. We have everything that we could need. We have everything that it takes. So it’s been a tremendous season. It’s been a battle so far. It’s been a long one, but it’s been a great one so far. The good thing is it’s a refresh button, you get to hit the refresh button, start over, 0-0, see how far we can go.” — Wilson.

6. MINNESOTA VIKINGS (10-6). AP Pro32 Ranking: No. 8. No Lombardis. Last year: 8-7-1. First trip to NFC playoffs since 2017.

YEA: The Vikings have an experienced, accomplished defense that can pose problems for elite QBs and clever play-callers on the other side. The Vikings were sixth in the NFL with an average of 18.9 points allowed and fourth with 31 takeaways. Their play-action passing attack with Pro Bowl RB Dalvin Cook poses a dual threat and QB Kirk Cousins throwing deep to WR Stefon Diggs, can be awfully dangerous, too.

NAY: The downside on defense is the erosion of the pass coverage. After ranking in the top three in passing yards allowed in the league in each of the past three years, the Vikings dropped to 15th in 2019. They also fell to 19th in the NFL in third down conversions allowed after leading the league in 2017 and 18. The offense carries its own reasons to doubt a playoff run, with Cousins never having won a postseason game in the NFL and a recent dud at home against division rival Green Bay.

SAY: “I know it’s been done before. Why not us?” — coach Mike Zimmer on the prospect of winning three road games to reach the Super Bowl.