Running into a wasp — or even worse, several wasps — on a nice summer day can be terrifying. Unlike honeybees, some wasp species are aggressive, and if they decide your can of Mt. Dew is actually their can of Mt. Dew you could be in for a painful confrontation.

But just how smart are wasps? Research on honeybees has shown that they don’t seem capable of logical reasoning, but a new study by scientists at the University of Michigan suggests that the same may not be true of paper wasps. The work, which was published in Biology Letters, reveals that paper wasps may be able to logically deduce facts based on their own observations.

Determining whether an organism can use logic to make decisions isn’t easy. As the researchers put it, a creature has to know that “if A is greater than B, and B is greater than C, then A is greater than C.” It sounds simple, but it can be hard to prove in practice.

For their test, the research team used color pairs that the insects had to familiarize themselves with. One of the colors provided a small electrical zap when touched while the other did not. The wasps rapidly learned which color was “safe” and which was not.

Then, the scientists introduced a new pair of colors for the insects to learn. After they had done so, the colors were intermixed into novel pairs that had not been presented previously. The wasps showed an ability to identify safe colors in these new contexts, suggesting they had learned what was safe and applied that knowledge even when faced with a new variable.

The statistics hinted at the wasps understanding and applying logic at a new problem, but the scientists are hesitant to declare that wasps use logic, at least in the way we think of it.

“We’re not saying that wasps used logical deduction to solve this problem, but they seem to use known relationships to make inferences about unknown relationships,” Elizabeth Tibbetts, an evolutionary biologist with the University of Michigan, said in a statement. “Our findings suggest that the capacity for complex behavior may be shaped by the social environment in which behaviors are beneficial, rather than being strictly limited by brain size.”

Further work would be needed to determine why wasps seem to possess this ability, even when similar species like honeybees do not. Still, it’s an interesting look into the mind of a common insect.