In a perfect world, you’re best friends with your neighbors. You share cups of sugar, invite each other over for the holidays, and always say hello by knocking on the back instead of the front door.

But this isn’t a perfect world, and neighbors don’t always get along. Sometimes relationships with neighbors can become contentious.

Whether they raise your hackles with loud parties, or with more serious or even dangerous behavior, here’s how to cope with neighbor disputes:

1. Decide who owns the problem. If a dead limb from your neighbor’s tree hangs over your yard, who is responsible for taking care of it?

Local laws vary, but generally, if it’s within your property limit, it’s your problem, says Justin Arpey, an attorney with Atlanta-based Davis, Matthews & Quigley. That means if your neighbor’s tree dangles over your yard, it’s up to you to take care of it.

If you’re in a condo, check your regulations and declarations to see what is considered common area. A crumbling wall could be considered a common area, which means the condo association must take care of it.

2. Talk it out. It’s an obvious step, but can be hard to do, especially if you’re not close. “Try to talk to them over the fence, or give them a call to see if you can establish some sort of direct communication,” says Kris Donley, executive director of the Austin Dispute Resolution Center in Austin, Texas. Your neighbors might not even know there’s a problem, and they might be more open to fixing the issue than you’d expect. Before you knock on their door, write out what you want to say, as if you’re about to give a speech. Having those talking points can keep you on task.

3. Mediation. Talking isn’t going to solve everything, especially if you’ve had conflicts with your neighbors in the past, or aren’t good at confrontation. “If you tend to freeze up or lose your temper, or if you have negative history with the neighbor, it makes sense to seek mediation at that point,” says Donley. You can find a licensed mediator in your area by going to the website for the National Association for Community Mediation. They’ll act as an impartial third party, working to find a consensus in your dispute. If you don’t see a mediator listed in your area, says Donley, call the NAFCM center at your state’s capital. They’ll tell you the best place to go.

Whatever the dispute, calling the police or threatening legal action is the last thing you want to do. Not only can suing your neighbor be expensive, but it’ll make you and your neighbors enemies until someone moves away.

“I would recommend trying to work it out between your neighbor and yourself ad nauseum to do anything you can to avoid getting a lawyer involved,” says Arpey. “Once you do that, it changes the game and it changes the relationship with your neighbor. Litigation just isn’t that fun.”