Dwight and Jim. Jim and Dwight. The unlikely duo on NBC's The Office who started out as worst enemies, but, after nine seasons, ended up as best friends. The pair go from the beginning of the show, when they hate sitting so close and make each others' lives miserable as much as possible, to the end, where Jim recommends Dwight for manager and Dwight makes Jim Bestest Mensch at his wedding.

But how do they get from that beginning to that ending? Well, much like most enemies-to-friends relationships, it happens very gradually. Still, though, if you watch closely, there are a few key moments that you can point out to really define their friendship and how it progresses.

Seasons Three and Four: They Begin to Care About Each Other

Jim and Dwight Money
via NBCUniversal

The Scranton branch's two most notable salesmen don't see much progress in Season One or Season Two. These seasons establish the adversarial relationship that the two have been dealing with for their first three years of working together.

Not much happens at the beginning of Season Three, either, since Jim spends the first several episodes at Stamford, and not in Scranton. Dwight does not miss Jim, but we actually see that Jim misses Dwight a little: He tries to prank Andy, but it does not go over well (for a multitude of reasons).

When Jim comes back, Dwight hardly reacts at all, but you can tell that Jim really missed messing with him from their first interaction. In the episode "Traveling Salesmen," you even get to see how well they used to work together: While they may bicker in the office, outside they're a well-oiled paper-selling machine, showing that they actually do work well together.

RELATED: The Office: Dwight Schrute's Backstory Was Not Planned

But there are two episodes early on that change everything for this pair. The first is

"The Negotiation" in Season Three, when Dwight saves Jim from being attacked by Roy with his can of pepper spray. At first, Jim can't figure out why he feels so uncomfortable about Dwight seeing all his gifts as pranks and not accepting them, until Karen wisely points out that it's probably because Jim feels guilty about pranking him so often. After this point, Jim starts to care a lot more about Dwight as a person, starting with keeping his secret about Angela.

The second episode is in Season Four: "Money." Seeing that Dwight isn't handling his breakup with Angela very well, Pam does her best to comfort Dwight, and encourages Jim to do the same. He goes beyond simply leaving a good review for his B&B online though: In the stairwell, when Dwight is crying over Angela, Jim comforts him, and Dwight even reaches out to hug him without realizing he's walked away. It's clear from this action alone that Dwight now sees Jim's good side, as much as Jim saw his when he rescued him.

Seasons Five to Seven: Jim Begins to Act Like a Friend

Jim and Dwight
via NBCUniversal

They’re close to becoming friends in Season Five, with Andy now there as a new enemy for Dwight – we see this as they work together as heads of the PPC, and at the company picnic when they hug briefly and Dwight stalls for Jim when he takes Pam to the hospital.

That all disappears, though, when Jim becomes manager in Season Six. Naturally, for Dwight, this makes them enemies again, and he plots to have Jim fired at every turn. Balance is restored when Jim becomes a salesman again. We see a little bonding at the end of this season, especially when Jim remodels their whole kitchen in "The Delivery," but it's really Season Seven when Jim begins to step it up in terms of friendship. (Maybe, as Pam says later on, it's because "having kids makes you soft.")

RELATED: 15 Times Dwight & Jim From The Office Were BFF #Goals

The episode "Counseling" is huge for these two, as Jim performs a full-on act of friendship for Dwight by masterminding the Pretty Woman scenario at the Steamtown Mall: He seems genuinely offended for Dwight that these store owners were making fun of his appearance, in an almost brotherly way. The Sting shows more of that same type of brotherly relationship.

At Erin and Gabe's "Viewing Party," though, it becomes clear that Dwight doesn't see their relationship the same way. He calls Jim his worst enemy out loud – but Jim contradicts it, saying they have a "charming back and forth." More importantly in this episode, though, Dwight gets his first taste of pranking Jim back, forcing him to feed him pizza and beer in return for keeping baby Cece asleep.

Seasons Seven and Eight: Dwight Slowly Realizes They’re Friends

Jim and Dwight PPC
via NBCUniversal

Dwight's adventures in pranking continue in "Classy Christmas." Though he goes a bit overboard because of who he is, Dwight is finally realizing the fun in pranking — Jim just needs to learn to take it as well as dish it. In reprimanding them, Holly says: "I'm surprised at you two. Last time I was here you were both best friends." They both look confused, you can see those words begin to hit Dwight...they kind of are friends. Would he admit it aloud? Not yet. But now the thought is in his head.

After that episode, it’s a very unstable alliance. Though they team up more frequently and the hate seems mostly gone, Dwight is a creature of habit, and still tries to get Jim fired more than once: He’s in denial, but there is so much evidence that they’re friends, like the mentoring Jim gives him in pranking in "Todd Packer."

RELATED: The Office: Here's Why Philip's DNA Test Said Dwight Wasn't The Father

After Jury Duty, when Dwight realizes he’s a father, he has even more sympathy for Jim, and more happiness in his life. This results in more acts of friendship and openness in the ensuing episodes. They start legitimately hanging out, and in the Season Eight episode "The Lotto," they are seen coming back from lunch together, deep in conversation, not once, but twice.

Still, neither of them would ever admit friendship out loud until after Florida. Dwight saves Jim from Cathy's advances, and they become roommates, but more importantly, Jim goes out of his way to save Dwight’s job. Once Dwight realizes how much Jim actually cares, there seems to be a mutual understanding between them: They are friends. They may prank each other, but now the pranks serve as the foundation of their friendship.

Season Nine: True Friendship

Jim and Dwight Guten Prank best man
via NBCUniversal

Still, neither of them admits this friendship out loud, and because of that there is still some inequality and misunderstanding there. They never talk about their feelings or resolve their power struggle, so both are sort of in the dark as to what the other one thinks of them. The episode "Work Bus" in Season Nine changes that.

In this episode, Jim expects Dwight to help him do something nice for Pam, because he considers them friends. Dwight, though, feels betrayed that Jim would step on him in that process. Dwight finally breaks and tells Jim: "You know what, we've been battling for a long time, but you win. You're the alpha male." Jim, finally realizing that he messed up, comforts Dwight, and admits that he can't do anything to help without Dwight, essentially telling him that HE wins. He even tells Pam that they bonded.

And with that, their power struggle is over, and that is very clear. In "Dwight Christmas," Dwight is as disappointed as Pam when Jim leaves early, and is the first to hug him when he returns. In the next episode, he accidentally says "Love you," at the end of a phone call with him - you can't get much closer than that.

In the end, the true slow burn relationship on The Office wasn't Jim and Pam, or Dwight and Angela, or even Andy and Erin: It was Jim and Dwight all along. They did more than go from enemies to friends, or even enemies to best friends: They went from enemies to brothers. Now that's a Guten Prank.

NEXT: The Office: When Did Dwight And Angela Start Dating?