Logic between two light switch

Hi, i buy 2 Sonoff 3 button light switch. Each has wired connect light on 1 and 3 button. I want set middle button as

  1. switch off all light connected to both switches
  2. switch off all light connected to second switch

i need, that when any light on 1 switch is ON, on the 2 switch turn ON middle button (for future switch OFF light on 1 switch), when all light on switch 1 is off middle button on 2 switch OFF too. this should work crosswise on both.

I hope it’s at least a bit understandable. Thank you