How to connect two tilesets?

Hello everyone, I’m very new to Tiled, literally started using it yesterday. So the first thing I did was RULES for auto mapping
I have two slightly different tilesets: First - dirt with grass; Second - dirth without grass. I have created these rules for them, and they work perfectly if separated !
image
but of course I can’t make them connect with each other, because each of them checks only for their type now
for example if I try to do this automap,
image
I get this
image

Any way to make them connect ?

An example of good working when separate ((I could only make 3 embed when created this topic))
image

oops, and the set of rules here:



Everything is of course separated on their layers
image

Hey @Narik_The_Programmer, welcome to the Tiled forum!

Actually I think the easiest way is to first make everything brown, using two input layers with the same name to code an “OR” condition. Then, in a second set of rules, you would replace the top tiles with the versions with grass whenever the input tile is green.