The lives of corvid, or the family of birds that include crows, are shockingly complex. They hold ‘monogamish’ relationships, build tools, hold funerals, solve puzzles, and may even have their own form of democracy. Now, researchers have provided the latest peek into corvid life that adds a new element to their intricate and complicated lives—social climbing. Yes, even birds will ditch their old friends if something better comes along, according to a new study published September 11 in Nature.

For their recent experiment, scientists at universities of Exeter and Bristol utilized the Cornish Jackdaw Project to split a group of jackdaws, members of the crow family found in Europe, western Asia and North Africa, into two randomly sorted groups—A and B. They then tagged the birds with transponder chips, worn like little anklets, to tell who was who. 

[Related: Crows and ravens flexed smarts and strength for world dominance.]

As many animal studies go, there’s got to be some kind of snack involved. This time, the scientists set up a feeding source with two locked doors—one filled with grain, a merely okay morsel for a hungry crow, and the other with a much yummier rendition of some grain and some dried mealworms. If a bird visited alone, only the low-quality snack door opened. With a buddy from the same-tagged group, say two As or two Bs, either both doors unlocked or just the high-quality snack door. But when a jackdaw visited the snack dispenser with a member of the opposite-tagged clique, there were no goodies for anybody.

The choice for the birds then was either loyalty or tasty treats. 

“The jackdaws turned out to be very strategic, quickly learning to hang out with members of their own group and ditching old ‘friends’ from the other group so they could get the best rewards,” author Alex Thornton, a professor of cognitive evolution at Exeter, said in a release.

The same couldn’t always be said for familial relationships. Despite the potentially disappointing outcome, jackdaws would still stick with their offspring, siblings, or mating partners. Some long-term relationships, it turns out, were more important to the feathery creatures than a chance at a delicious morsel. 

“The fundamental idea is that if you need to keep track of interactions you have had with other individuals, remember the outcomes of those interactions and use those to adjust your [behavior],” Thornton told the Guardian. “What we were able to do here was test the idea: can individuals keep track of the outcomes of past interactions and update their relationships. It turns out they can.”

For the authors, these results can give us clues to the evolution of intelligence, memory, and social status in the animal kingdom—and even in the human world. 

“Our findings also help us to understand how societies emerge from individual decisions,” author and Exeter PhD student Josh Arbon said in a release. “The balance between strategically playing the field for short-term benefits and investing in valuable long-term partners ultimately shapes the structure of animal societies, including our own.”