Arduino sketch from truth table

Unfortunately I don't have any schematic. But imagine some kind of a 13 relay module and the buttons are the S1-S6. I hope you can understand now better