Tristating port bits connected in parallel

Imagine a "master" Arduino (M) which is connected to 2 other "slave" Arduinos (SA & SB).

Imagine that 4 bits of all three Arduino's are connected together in parallel. The master M always has its bits as input. And by default the slaves have their bits configured as inputs.

Imagine that one of the two slaves (say slave A) has to send 4 bit data to the master. Can I make slave B's bits configured as input then output the data from slave A?

Ignore the problem of having two slaves outputting at the same time, that would never happen for mechanical reasons.

Yes you can change the input / output designation of bits on the fly. Remember you will need some hand shaking lines as well as data lines to communicate between the two.

However why not use the SPI lines to communicate between two devices or the I2C as those have protocols and libraries dedicated to them to make talking easer?

Thanks for the info and the suggestion too.

I don't know much about the two wire comms, so I'll need to investigate a bit.